[Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933 --- Comment #4 from Mikael Morin --- (In reply to Paul Thomas from comment #3) > (In reply to Mikael Morin from comment #2) > > The generated finalization wrapper has code doing > > deallocate(ptr2%classes(:)%class_var) > > where ptr2 is a pointer of type list_t to be finalized. > > This is missing scalarization, a correct code would do instead: > > do i=1,size(ptr2) This should use size(ptr2%classes) instead. > > ptr3 => ptr2%classes(i) > > deallocate (ptr3%class_var) > > end do > > Hi Mikael, > > This does not seem to be the problem. It is actually the > gfc_reset_vptr (, al->expr); > at trans-stmt.c:6048. > The problem is indeed in gfc_reset_vptr. It is trying to do lhs%_vptr => The lhs is ptr2%classes(:)%class_var (as I said above) which has nonzero rank, so the code is expecting an array descriptor assignment, which the rhs isn't. > Once gfc_reset_vptr is modified to quit if it doesn't find a vptr, > compilation succeeds and the finalizer has: > Uh, I didn't expect scalarization to work with the rest of the code either; good this should make the problem easier to fix.
[Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933 Paul Thomas changed: What|Removed |Added CC||pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #3 from Paul Thomas --- (In reply to Mikael Morin from comment #2) > The generated finalization wrapper has code doing > deallocate(ptr2%classes(:)%class_var) > where ptr2 is a pointer of type list_t to be finalized. > This is missing scalarization, a correct code would do instead: > do i=1,size(ptr2) > ptr3 => ptr2%classes(i) > deallocate (ptr3%class_var) > end do Hi Mikael, This does not seem to be the problem. It is actually the gfc_reset_vptr (, al->expr); at trans-stmt.c:6048. Once gfc_reset_vptr is modified to quit if it doesn't find a vptr, compilation succeeds and the finalizer has: S.7 = 0; while (1) { if (S.7 > 9) goto L.11; if (ptr2->classes[S.7].class_var._data != 0B && ptr2->classes[S.7].class_var._vptr->_final != 0B) { desc.8.dtype = 296; desc.8.data = (void * restrict) ptr2->classes[S.7].class_var._data; ptr2->classes[S.7].class_var._vptr->_final (, (integer(kind=8)) ptr2->classes[S.7].class_var._vptr->_size, 1); } if (ptr2->classes[S.7].class_var._data != 0B) { __builtin_free ((void *) ptr2->classes[S.7].class_var._data); } ptr2->classes[S.7].class_var._data = 0B; S.7 = S.7 + 1; } L.11:; I'll post the patch as soon as I understand where the vptr's go to. Cheers Paul
[Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933 Mikael Morin changed: What|Removed |Added CC||mikael at gcc dot gnu.org Blocks|37336 | --- Comment #2 from Mikael Morin --- The generated finalization wrapper has code doing deallocate(ptr2%classes(:)%class_var) where ptr2 is a pointer of type list_t to be finalized. This is missing scalarization, a correct code would do instead: do i=1,size(ptr2) ptr3 => ptr2%classes(i) deallocate (ptr3%class_var) end do Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336 [Bug 37336] [F03] Finish derived-type finalization
[Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933 Dominique d'Humieres changed: What|Removed |Added Keywords||ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed||2015-10-13 Known to work||4.8.5 Ever confirmed|0 |1 Known to fail||4.9.3, 5.2.0, 6.0 --- Comment #1 from Dominique d'Humieres --- Confirmed. The ICE appeared between revisions r206362 (2014-01-06, compiles) and r206567 (2014-01-12, ICE): usual suspect r206379 (pr59589).
[Bug fortran/67933] [4.9/5/6 Regression] ICE for array of a derived type with allocatable class in derived type object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933 Richard Biener changed: What|Removed |Added Target Milestone|--- |4.9.4 Summary|[4.9/5/Trunk Regression]|[4.9/5/6 Regression] ICE |ICE for array of a derived |for array of a derived type |type with allocatable class |with allocatable class in |in derived type object |derived type object