Created attachment 48536 [details] Fortran code demonstrating problems. Hi all! ICE on 10 and 11, 9 compiles part of the code, so there is also some aspect of regression here. Using -Wsurprising gives surprising (to me...) diagnostics. Not sure if all the code is kosher, most likely it is not... using: GNU Fortran (GCC) 11.0.0 20200513 (experimental) GNU Fortran (GCC) 10.1.1 20200513 GNU Fortran (GCC) 9.3.1 20200513 Thank you very much. Best regards, José Rui
A small subset of the reproducer shows that invalid code is generated: program transfer_p implicit none integer, parameter :: n = 3 class(*), allocatable :: o(:) integer :: v(n) integer :: i v = [(i, i=1,n)] allocate(o, source=v) print *, "size (o) =", size (o) print *, transfer(o, v) end This compiles and gives: size (o) = 3 1 2 3 0 0 0 while compiling with -fdefault-integer-8 gives the correct answer: size (o) = 3 1 2 3 A look at the dump appears to give some hint where to look further.
Another datapoint: inserting select type (o) type is (integer) print *, transfer(o, v) end select prints the right thing: 1 2 3 Also note the possibly related PR84006, where one gets an ICE on print *, "storage_size (o) =", storage_size (o) ! ICE unless one places this inside a select type.
Confirmed from GGC7 up to master.