------- Comment #3 from burnus at gcc dot gnu dot org 2008-01-29 13:22 ------- > Note the comment in trans-expr.c(gfc_map_intrinsic_function) : > case GFC_ISYM_LBOUND: > case GFC_ISYM_UBOUND: > /* TODO These implementations of lbound and ubound do not limit if > the size < 0, according to F95's 13.14.53 and 13.14.113. */
I had the impression that the problem is the array itself and not only ubound/lbound. You can replace LBOUND(TEST_ARRAY) by "print *, TEST_ARRAY", "SIZE(TEST_ARRAY)" etc. You will always get the middle end error: a.f:11: error: size of variable test_array is too large (gcc/varasm.c:2095). What I find puzzling is the following: implicit none integer :: i(kind(4):1) integer :: j(4:1) print *, i(4:3) print *, j(4:3) end "j" works but "i" gives the same error message. If the size is not known at compile time (e.g. an automatic array) it seems to work. Actually, replacing "j(4:1)" by "j((4):1)" is enough to make it fail. I think "4:1" is replaced by "1:0" while "(4):1" is replaced by "4:1". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34945