------- Comment #6 from kargl at gcc dot gnu dot org 2009-04-16 17:31 ------- well, that was an inconvenient goose chase. (Note to self: always check the Standard).
I'm tempted to close this with INVALID because the F95 Standard explicitly states that SIZE() has a "Result Characteristics. Default integer scalar." and it further states A program is prohibited from invoking an intrinsic procedure under circumstances where a value to be returned in a subroutine argument or function result is outside the range of values representable by objects of the specified type and type parameters. Thus, it is the users' responsibility to catch a possible problem. INTEGER*8 :: N INTEGER, DIMENSION(:), ALLOCATABLE :: data N=2_8**32 write(6,*) N ALLOCATE(data(N)) if (n, < int(huge(1), 8)) then write(6,*) SIZE(data,1) end if END That being said, I'm changing this from an enhancement request to a wrong-code bug because gfortran has grown support for the F2003 standards' optional kind argument. F2003 standard has Result Characteristics. Integer scalar. If KIND is present, the kind type parameter is that specified by the value of KIND; otherwise the kind type parameter is that of default integer type. NTEGER*8 :: N INTEGER, DIMENSION(:), ALLOCATABLE :: data N=2_8**32 write(6,*) N ALLOCATE(data(N)) write(6,*) SIZE(data,kind=8) END REMOVE:kargl[253] gfc4x -o z -fdump-tree-original d.f90 REMOVE:kargl[254] ./z 4294967296 0 This is clearly wrong, and -fdump-tree-original shows that the computation of size is doen in INTEGER*4. -- kargl at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal Priority|P3 |P4 Last reconfirmed|2009-04-15 17:43:49 |2009-04-16 17:31:44 date| | Summary|add a correctness check for |SIZE intrinsic ignores |the size intrinsic to - |optional KIND argument |fbounds-check | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39772