https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112371
--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> --- (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.