From: pault Date: Fri, 20 Nov 2015 14:50:35 +0000 (+0000) Subject: 2015-11-20 Paul Thomas X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe9d2f5af8bfc135040406ea88d194b5d88e6c0f;p=thirdparty%2Fgcc.git 2015-11-20 Paul Thomas PR fortran/68237 * decl.c (gfc_match_submod_proc): Test the interface symbol before accessing its attributes. 2015-11-20 Steven G. Kargl PR fortran/66762 (gfc_get_symbol_decl): Test for attr.used_in_submodule as well as attr.use_assoc (twice). (gfc_create_module_variable): Ditto. 2015-11-20 Paul Thomas PR fortran/68237 * gfortran.dg/submodule_12.f90: New test PR fortran/66762 * gfortran.dg/submodule_6.f90: Add compile option -flto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230661 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3bd9743468f2..1c38f958ba04 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2015-11-20 Paul Thomas + + PR fortran/68237 + * decl.c (gfc_match_submod_proc): Test the interface symbol + before accessing its attributes. + +2015-11-20 Steven G. Kargl + + PR fortran/66762 + (gfc_get_symbol_decl): Test for attr.used_in_submodule as well + as attr.use_assoc (twice). + (gfc_create_module_variable): Ditto. + 2015-11-18 Steven G. Kargl PR fortran/59910 @@ -7,7 +20,7 @@ 2015-11-18 Steven G. Kargl PR fortran/43996 - * simplify.c (gfc_simplify_spread): Issue error for too large array + * simplify.c (gfc_simplify_spread): Issue error for too large array constructor in a PARAMETER statement. 2015-11-17 Steven G. Kargl diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 6d76a7fd5aef..c4ce18b9ad9d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -7666,7 +7666,7 @@ gfc_match_submod_proc (void) /* Make sure that the result field is appropriately filled, even though the result symbol will be replaced later on. */ - if (sym->ts.interface->attr.function) + if (sym->ts.interface && sym->ts.interface->attr.function) { if (sym->ts.interface->result && sym->ts.interface->result != sym->ts.interface) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 7e05e673a8c4..0e5eecc70e4c 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1497,7 +1497,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) declaration. */ if ((sym->attr.flavor == FL_VARIABLE || sym->attr.flavor == FL_PARAMETER) - && sym->attr.use_assoc + && (sym->attr.use_assoc || sym->attr.used_in_submodule) && !intrinsic_array_parameter && sym->module && gfc_get_module_backend_decl (sym)) @@ -4499,7 +4499,7 @@ gfc_create_module_variable (gfc_symbol * sym) decl = sym->backend_decl; gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE); - if (!sym->attr.use_assoc) + if (!sym->attr.use_assoc && !sym->attr.used_in_submodule) { gcc_assert (TYPE_CONTEXT (decl) == NULL_TREE || TYPE_CONTEXT (decl) == sym->ns->proc_name->backend_decl); @@ -4531,7 +4531,8 @@ gfc_create_module_variable (gfc_symbol * sym) /* Don't generate variables from other modules. Variables from COMMONs and Cray pointees will already have been generated. */ - if (sym->attr.use_assoc || sym->attr.in_common || sym->attr.cray_pointee) + if (sym->attr.use_assoc || sym->attr.used_in_submodule + || sym->attr.in_common || sym->attr.cray_pointee) return; /* Equivalenced variables arrive here after creation. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b74a99f064d..b6810c8fd786 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-11-20 Paul Thomas + + PR fortran/68237 + * gfortran.dg/submodule_12.f90: New test + + PR fortran/66762 + * gfortran.dg/submodule_6.f90: Add compile option -flto. + 2015-11-20 Andre Vieira * lib/target-supports.exp diff --git a/gcc/testsuite/gfortran.dg/submodule_12.f08 b/gcc/testsuite/gfortran.dg/submodule_12.f08 new file mode 100644 index 000000000000..6fba4bf645e5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/submodule_12.f08 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! Test the fix for PR68237 in which 'foo' caused a seg fault rather than an error. +! +! Contributed by Martin Reinecke +! +module m1 + interface + module subroutine bar + end subroutine + end interface +end module m1 + +submodule (m1) m2 +contains + module procedure foo ! { dg-error "must be in a generic module interface" } + end procedure ! { dg-error "Expecting END SUBMODULE statement" } +end submodule diff --git a/gcc/testsuite/gfortran.dg/submodule_6.f08 b/gcc/testsuite/gfortran.dg/submodule_6.f08 index e0b195e91de3..b453b5444b10 100644 --- a/gcc/testsuite/gfortran.dg/submodule_6.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_6.f08 @@ -1,6 +1,9 @@ ! { dg-do run } +! { dg-options "-flto" } ! -! Checks that the results of module procedures have the correct characteristics. +! Checks that the results of module procedures have the correct characteristics +! and that submodules use the module version of vtables (PR66762). This latter +! requires the -flto compile option. ! ! Contributed by Reinhold Bader !