Hi Mikael, hi all, Mikael, thanks for the review. Commited as r222539 including the improved regexp.
Regards, Andre On Tue, 28 Apr 2015 14:05:57 +0200 Mikael Morin <mikael.mo...@sfr.fr> wrote: > Hello, > > Le 28/04/2015 12:43, Andre Vehreschild a écrit : > > To get the testsuite accepting a dump-fortran-original, I had to insert a > > dg-prune-output. Without the prune output, dejagnu was reporting excess > > errors. The prune removes all output after the first Namespace: that starts > > the fortran-dump. I am not that happy with it, because ICEs in the dump > > will not be detected that way. But I could not find a better solution yet. > > Does anyone know of a better way to solve this? Best would be to have the > > fortran dump go to a file like all other dumps, but that is not scope of > > this patch. > > > Without a better idea, the scope of the dg-prune-output should be > limited at least. > As the dump ends with a "-------" line, you can use the > "Namespace:.*-{42}" regular expression. > OK with that change. Thanks. > > Mikael -- Andre Vehreschild * Email: vehre ad gmx dot de
Index: gcc/testsuite/gfortran.dg/implicit_class_1.f90 =================================================================== --- gcc/testsuite/gfortran.dg/implicit_class_1.f90 (Revision 222538) +++ gcc/testsuite/gfortran.dg/implicit_class_1.f90 (Arbeitskopie) @@ -4,6 +4,12 @@ ! ! Contributed by Reinhold Bader <reinhold.ba...@lrz.de> +! Add dump-fortran-original to check, if the patch preventing a gfortran +! segfault is working correctly. No cleanup needed, because the dump +! goes to stdout. +! { dg-options "-fdump-fortran-original" } +! { dg-prune-output "Namespace:.*-{42}" } + program upimp implicit class(foo) (a-b) implicit class(*) (c) Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 222538) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2015-04-28 Andre Vehreschild <ve...@gmx.de> + + * gfortran.dg/implicit_class_1.f90: Adding flag to check, if + segfault is fixed. + 2015-04-28 Bill Schmidt <wschm...@linux.vnet.ibm.com> * gcc.dg/vect/vect-33.c: Remove spurious line. Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (Revision 222538) +++ gcc/fortran/interface.c (Arbeitskopie) @@ -484,13 +484,24 @@ if (ts1->type == BT_VOID || ts2->type == BT_VOID) return 1; - if (ts1->type == BT_CLASS - && ts1->u.derived->components->ts.u.derived->attr.unlimited_polymorphic) + /* The _data component is not always present, therefore check for its + presence before assuming, that its derived->attr is available. + When the _data component is not present, then nevertheless the + unlimited_polymorphic flag may be set in the derived type's attr. */ + if (ts1->type == BT_CLASS && ts1->u.derived->components + && ((ts1->u.derived->attr.is_class + && ts1->u.derived->components->ts.u.derived->attr + .unlimited_polymorphic) + || ts1->u.derived->attr.unlimited_polymorphic)) return 1; /* F2003: C717 */ if (ts2->type == BT_CLASS && ts1->type == BT_DERIVED - && ts2->u.derived->components->ts.u.derived->attr.unlimited_polymorphic + && ts2->u.derived->components + && ((ts2->u.derived->attr.is_class + && ts2->u.derived->components->ts.u.derived->attr + .unlimited_polymorphic) + || ts2->u.derived->attr.unlimited_polymorphic) && (ts1->u.derived->attr.sequence || ts1->u.derived->attr.is_bind_c)) return 1; Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 222538) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,11 @@ +2015-04-28 Andre Vehreschild <ve...@gmx.de> + + * interface.c (gfc_compare_types): Check for unlimited + polymorphism flag in the correct position indepent of the _data + component being present or not. This prevents a segfault, when + the _data component is not present. + * symbol.c (gfc_type_compatible): Same. + 2015-04-27 Jim Wilson <jim.wil...@linaro.org> * Make-lang.in (fortran.mostlyclean): Remove gfortran and Index: gcc/fortran/symbol.c =================================================================== --- gcc/fortran/symbol.c (Revision 222538) +++ gcc/fortran/symbol.c (Arbeitskopie) @@ -4567,7 +4567,10 @@ if (is_class1 && ts1->u.derived->components - && ts1->u.derived->components->ts.u.derived->attr.unlimited_polymorphic) + && ((ts1->u.derived->attr.is_class + && ts1->u.derived->components->ts.u.derived->attr + .unlimited_polymorphic) + || ts1->u.derived->attr.unlimited_polymorphic)) return 1; if (!is_derived1 && !is_derived2 && !is_class1 && !is_class2) @@ -4578,13 +4581,21 @@ if (is_derived1 && is_class2) return gfc_compare_derived_types (ts1->u.derived, - ts2->u.derived->components->ts.u.derived); + ts2->u.derived->attr.is_class ? + ts2->u.derived->components->ts.u.derived + : ts2->u.derived); if (is_class1 && is_derived2) - return gfc_type_is_extension_of (ts1->u.derived->components->ts.u.derived, + return gfc_type_is_extension_of (ts1->u.derived->attr.is_class ? + ts1->u.derived->components->ts.u.derived + : ts1->u.derived, ts2->u.derived); else if (is_class1 && is_class2) - return gfc_type_is_extension_of (ts1->u.derived->components->ts.u.derived, - ts2->u.derived->components->ts.u.derived); + return gfc_type_is_extension_of (ts1->u.derived->attr.is_class ? + ts1->u.derived->components->ts.u.derived + : ts1->u.derived, + ts2->u.derived->attr.is_class ? + ts2->u.derived->components->ts.u.derived + : ts2->u.derived); else return 0; }