https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68218
Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #2 from Harald Anlauf <anlauf at gmx dot de> --- This jewel is really funny. Extending the testcase in comment #0: MODULE mo_test implicit none integer :: n = 0 CONTAINS FUNCTION nquery() INTEGER :: nquery n = n + 1 WRITE (0,*) "hello #", n nquery = n END FUNCTION nquery END MODULE mo_test ! ---------------------------------------------------------------------- ! MAIN PROGRAM ! ---------------------------------------------------------------------- PROGRAM example USE mo_test implicit none INTEGER, ALLOCATABLE :: query_buf(:) ALLOCATE(query_buf(nquery())) print *, "n, size (query_buf) =", n, size (query_buf) if (n /= 1 .or. size (query_buf) /= n) print *, "ERROR!" END PROGRAM example one finds: 4.3, 4.6: hello # 1 hello # 2 hello # 3 hello # 4 n, size (query_buf) = 4 1 ERROR! 4.7 and newer: hello # 1 hello # 2 hello # 3 hello # 4 n, size (query_buf) = 4 4 ERROR! Looking at the dump tree, there is no temporary generated for the function result. If one was interested only in the size of query_buf, this would be technically a regression...