This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

what is the option I am looking for?


Hi
   May be this is a stupid question. I have a bad code and I want
gfortran to flag an error whenever I use such construction. I dont
know what option I have to use so that gfortran catches it either at
runtime or compile time. Can someone help me?

$car test2.f90

module dummy
  implicit none
  real, allocatable :: gen(:)
contains

subroutine does_it_work(temp)
  implicit none
  real :: temp(1:5)

  ! This is not good code. But let's see what actually happens.
  write(*,*) size(temp)
end subroutine does_it_work
end module dummy

program test
  use dummy
  implicit none
  call does_it_work(gen)
end program test

$gfortran -Wall -fbounds-check test2.f90

$./a.out
           5

A good compiler should point out that 'gen' is an unallocated array
and calling its size does not make any sense.

thanks in advance
raju

-- 
Kamaraju S Kusumanchi
http://people.cornell.edu/pages/kk288/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]