[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 Paul Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Paul Thomas --- Fixed on all affected branches. Thanks for the report Paul
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 --- Comment #7 from Paul Thomas --- Author: pault Date: Sun Feb 3 18:23:25 2019 New Revision: 268501 URL: https://gcc.gnu.org/viewcvs?rev=268501=gcc=rev Log: 2019-02-03 Paul Thomas Backport from trunk PR fortran/88393 * trans-expr.c (gfc_conv_procedure_call): For derived entities, passed in parentheses to class formals, invert the order of copying allocatable components to taking the _data of the class expression. 2019-02-03 Paul Thomas Backport from trunk PR fortran/88393 * gfortran.dg/alloc_comp_assign_16.f03 : New test. Added: branches/gcc-7-branch/gcc/testsuite/gfortran.dg/alloc_comp_assign_16.f03 Modified: branches/gcc-7-branch/gcc/fortran/ChangeLog branches/gcc-7-branch/gcc/fortran/trans-expr.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 --- Comment #6 from Paul Thomas --- Author: pault Date: Sun Feb 3 14:50:07 2019 New Revision: 268489 URL: https://gcc.gnu.org/viewcvs?rev=268489=gcc=rev Log: 2019-02-03 Paul Thomas Backport from trunk PR fortran/88393 * trans-expr.c (gfc_conv_procedure_call): For derived entities, passed in parentheses to class formals, invert the order of copying allocatable components to taking the _data of the class expression. 2019-02-03 Paul Thomas Backport from trunk PR fortran/88393 * gfortran.dg/alloc_comp_assign_16.f03 : New test. Added: branches/gcc-8-branch/gcc/testsuite/gfortran.dg/alloc_comp_assign_16.f03 Modified: branches/gcc-8-branch/gcc/fortran/ChangeLog branches/gcc-8-branch/gcc/fortran/trans-expr.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 --- Comment #5 from Paul Thomas --- Author: pault Date: Sat Feb 2 09:23:30 2019 New Revision: 268474 URL: https://gcc.gnu.org/viewcvs?rev=268474=gcc=rev Log: 2019-02-02 Paul Thomas PR fortran/88393 * trans-expr.c (gfc_conv_procedure_call): For derived entities, passed in parentheses to class formals, invert the order of copying allocatable components to taking the _data of the class expression. 2019-02-02 Paul Thomas PR fortran/88393 * gfortran.dg/alloc_comp_assign_16.f03 : New test. Added: trunk/gcc/testsuite/gfortran.dg/alloc_comp_assign_16.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 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 #4 from Paul Thomas --- I am just about to post a patch. Paul
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 janus at gcc dot gnu.org changed: What|Removed |Added CC||vehre at gcc dot gnu.org --- Comment #3 from janus at gcc dot gnu.org --- (In reply to janus from comment #2) > Looking at this range of commits, I suspect that r241885 is the culprit. Using -fdump-tree-original to compare the dumps of versions 6 and 7 shows that the assignment subroutine itself is identical in both, but the dump from v7 contains additional code after the call to 'ass' that is not present in v6. With v6, the call is translated as follows: { struct __class_m_T_t class.7; struct __class_m_T_t class.8; class.7._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T; class.7._data = [1].c; class.8._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T; class.8._data = [0].c; ass (, ); } With v7, it looks much bulkier: { struct __class_m_T_t class.7; struct __class_m_T_t class.8; struct t D.3602; struct __class_m_T_t * D.3603; struct __class_m_T_t D.3604; void * restrict D.3605; class.7._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T; class.7._data = [1].c; class.8._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T; D.3602 = arr[0].c; class.8._data = D.3603 = D.3604 = *D.3603; ass (, D.3603); D.3603->_cs_length = D.3604._cs_length; if ((void *) D.3604.cs != 0B) { D.3605 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long) D.3603->_cs_length, 1>); D.3603->cs = (character(kind=1)[1:0] *) D.3605; __builtin_memcpy (D.3603->cs, D.3604.cs, (unsigned long) D.3603->_cs_length); } else { D.3603->cs = 0B; } if (D.3603->_data->cs != 0B) { __builtin_free ((void *) D.3603->_data->cs); D.3603->_data->cs = 0B; } } Looks like there is some copying and deallocation of the allocatable components here. Not sure why that would be necessary ...?!?
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 --- Comment #2 from janus at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #1) > The test compiled with r241883 + patches (2016-11-06) gives the expected > result, compiled with r241924 + patches (2016-11-07) gives a segfault at run > time. Thanks for the information. Looking at this range of commits, I suspect that r241885 is the culprit.
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 Dominique d'Humieres changed: What|Removed |Added Keywords||wrong-code Status|UNCONFIRMED |NEW Last reconfirmed||2018-12-09 Ever confirmed|0 |1 Known to fail||7.3.0, 8.2.0, 9.0 --- Comment #1 from Dominique d'Humieres --- The test compiled with r241883 + patches (2016-11-06) gives the expected result, compiled with r241924 + patches (2016-11-07) gives a segfault at run time.
[Bug fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88393 Richard Biener changed: What|Removed |Added Priority|P3 |P4 Known to work||6.4.0 Target Milestone|--- |7.5