the following program INTEGER*8 :: N INTEGER, DIMENSION(:), ALLOCATABLE :: data N=2_8**32 write(6,*) N ALLOCATE(data(N)) write(6,*) SIZE(data,1) END
prints 4294967296 0 It would be useful if a check for overflow of size could be added to e.g. -fbounds-check (a rather natural place I would say) so that this kind of undefined behavior could be detected at run time. I'm aware of the fact that this is fixed more fundamentally with F2003. -- Summary: add a correctness check for the size intrinsic to - fbounds-check Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39772