[Bug fortran/112371] Wrong upper bound for the result of reduction intrinsics if the array is empty
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112371 --- Comment #3 from Mikael Morin --- Possible culprit: ifunction.m4 has this code: retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; }
[Bug fortran/112371] Wrong upper bound for the result of reduction intrinsics if the array is empty
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112371 --- Comment #2 from Mikael Morin --- If dim == 3, the ubound and shape are (/ 9, 3, 7 /) as expected. That is, the problem only arises if the resulting array is empty.
[Bug fortran/112371] Wrong upper bound for the result of reduction intrinsics if the array is empty
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112371 --- Comment #1 from Mikael Morin --- (In reply to Mikael Morin from comment #0) > i = 1 > (...) > r = sum(a, dim=i) If i is inlined, that is r = sum(a, dim=1) the shape and ubound are (/ 3, 0, 7 /) as expected. The difference is probably caused by inline vs library implementation.