diff options
author | Fritz Reese <foreese@gcc.gnu.org> | 2020-04-02 13:50:11 -0400 |
---|---|---|
committer | Fritz Reese <foreese@gcc.gnu.org> | 2020-04-02 13:50:11 -0400 |
commit | 0cd74f3588928e22c08003c643c91340f555785e (patch) | |
tree | 386c43fde7ab6c62a0f116de465f979b7cca98df /gcc/fortran | |
parent | 3ab216a4d2f14be1f37350260142c91fabce834a (diff) | |
download | gcc-0cd74f3588928e22c08003c643c91340f555785e.zip gcc-0cd74f3588928e22c08003c643c91340f555785e.tar.gz gcc-0cd74f3588928e22c08003c643c91340f555785e.tar.bz2 |
Fix fortran/85982 ICE in resolve_component.
2020-04-01 Fritz Reese <foreese@gcc.gnu.org>
PR fortran/85982
* fortran/decl.c (match_attr_spec): Lump COMP_STRUCTURE/COMP_MAP into
attribute checking used by TYPE.
2020-04-01 Fritz Reese <foreese@gcc.gnu.org>
PR fortran/85982
* gfortran.dg/dec_structure_28.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/decl.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 79c9510..ea30908 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5408,15 +5408,19 @@ match_attr_spec (void) if (d == DECL_STATIC && seen[DECL_SAVE]) continue; - if (gfc_current_state () == COMP_DERIVED + if (gfc_comp_struct (gfc_current_state ()) && d != DECL_DIMENSION && d != DECL_CODIMENSION && d != DECL_POINTER && d != DECL_PRIVATE && d != DECL_PUBLIC && d != DECL_CONTIGUOUS && d != DECL_NONE) { + bool is_derived = gfc_current_state () == COMP_DERIVED; if (d == DECL_ALLOCATABLE) { - if (!gfc_notify_std (GFC_STD_F2003, "ALLOCATABLE " - "attribute at %C in a TYPE definition")) + if (!gfc_notify_std (GFC_STD_F2003, is_derived + ? G_("ALLOCATABLE attribute at %C in a " + "TYPE definition") + : G_("ALLOCATABLE attribute at %C in a " + "STRUCTURE definition"))) { m = MATCH_ERROR; goto cleanup; @@ -5424,8 +5428,11 @@ match_attr_spec (void) } else if (d == DECL_KIND) { - if (!gfc_notify_std (GFC_STD_F2003, "KIND " - "attribute at %C in a TYPE definition")) + if (!gfc_notify_std (GFC_STD_F2003, is_derived + ? G_("KIND attribute at %C in a " + "TYPE definition") + : G_("KIND attribute at %C in a " + "STRUCTURE definition"))) { m = MATCH_ERROR; goto cleanup; @@ -5448,8 +5455,11 @@ match_attr_spec (void) } else if (d == DECL_LEN) { - if (!gfc_notify_std (GFC_STD_F2003, "LEN " - "attribute at %C in a TYPE definition")) + if (!gfc_notify_std (GFC_STD_F2003, is_derived + ? G_("LEN attribute at %C in a " + "TYPE definition") + : G_("LEN attribute at %C in a " + "STRUCTURE definition"))) { m = MATCH_ERROR; goto cleanup; @@ -5472,8 +5482,10 @@ match_attr_spec (void) } else { - gfc_error ("Attribute at %L is not allowed in a TYPE definition", - &seen_at[d]); + gfc_error (is_derived ? G_("Attribute at %L is not allowed in a " + "TYPE definition") + : G_("Attribute at %L is not allowed in a " + "STRUCTURE definition"), &seen_at[d]); m = MATCH_ERROR; goto cleanup; } |