http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57904
Bug ID: 57904
Summary: Bogus(?) "invokes undefined behavior" warning with
Fortran's finalization wrapper
(gfortran.dg/class_48.f90)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
The test case is based on gfortran.dg/class_48.f90 - and the issue is exposed
by r200954.
Compiling the following test case with "gfortran -m32 -O2" (or "-m32 -Os")
gives the warning:
test.f90: In function '__final_test2_T.1838.constprop.0':
test.f90:21:0: warning: iteration 2147483648 invokes undefined behavior
[-Waggressive-loop-optimizations]
class(t), allocatable :: a
^
Test case:
program test
call test2 ()
contains
subroutine test2 ()
type t
integer, allocatable :: x
end type t
type t2
class(t), allocatable :: a
end type t2
type(t2) :: one, two
allocate (two%a)
one = two
end subroutine test2
end program test