Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Passing a null pointer to a subroutine fails with segv

$
0
0
!==================================================
!
! Compile and run using:
!  ifort optional-bug.f90
!  ./a.out
!==================================================
program option
  implicit none

  real, target  :: at, dt
  real, pointer :: ap, dp

  at = 10; dt = 40

  ap => at
  dp => dt
  dp => null()              ! Uncommenting this line crashes

  print*, 'before ap, dp', ap, dp

  call mysub(ap, dp)

  print*, 'after ap, dp', ap, dp

  contains

    subroutine mysub(aa, dd)

      real :: aa
      real :: dd

      aa = 1000.*aa
      print*, ' Inside mysub aa = ', aa

    end subroutine mysub

end program option

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>