[Bug fortran/95138] ICE on transfer to unlimited polymorphic

2020-06-09 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95138

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed|2020-05-14 00:00:00 |2020-06-09

--- Comment #3 from Dominique d'Humieres  ---
Confirmed from GGC7 up to master.

[Bug fortran/95138] ICE on transfer to unlimited polymorphic

2020-05-16 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95138

--- Comment #2 from anlauf at gcc dot gnu.org ---
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.

[Bug fortran/95138] ICE on transfer to unlimited polymorphic

2020-05-14 Thread anlauf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95138

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

   Last reconfirmed||2020-5-14
 CC||anlauf at gcc dot gnu.org
   Keywords||ice-on-valid-code,
   ||wrong-code
   Priority|P3  |P4

--- Comment #1 from anlauf at gcc dot gnu.org ---
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
123

A look at the dump appears to give some hint where to look further.