the if statement crashes the code:
> 
>       program t
>       integer*4 i
>       real*4 a(10)
>       do i = 1, 10
>          a(i) = i
>       end do
>       i = 0
>       if ( i .gt. 0 .and. a(i) .gt. 0 ) then
>          i = i + 1
>          write(*,*) i
>       end if
>       end
> 
>  $ gfortran -fbounds-check -o t.exe t.f
>  $ t.exe 
> Fortran runtime error: Array reference out of bounds for array 'a',
> lower bound of dimension 1 exceeded (in file 't.f', at line 8)
With all other FORTAN compilers I've worked so far this does not happen as
after the first condition is not fulfilled the second is never tested.
This problem makes impossible to develope a program in GFROTRAN environment.


-- 
           Summary: crash in if ( i .gt. 0 .and. a(i) .gt. 0 ) when a(0) is
                    out of bounds
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dusan dot turk at ijs dot si


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33525

Reply via email to