diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2015-10-04 12:30:16 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2015-10-04 12:30:16 +0000 |
commit | 2b3f52a2d0fb22bab9a3fdf94eaaa3d6829608fd (patch) | |
tree | 0e37a535c2fb1ad4175640b01e0f4518a0f4ece7 /gcc/fortran/resolve.c | |
parent | 6dcab5071487cfb42b4414d08c517210fac94d00 (diff) | |
download | gcc-2b3f52a2d0fb22bab9a3fdf94eaaa3d6829608fd.zip gcc-2b3f52a2d0fb22bab9a3fdf94eaaa3d6829608fd.tar.gz gcc-2b3f52a2d0fb22bab9a3fdf94eaaa3d6829608fd.tar.bz2 |
Fix fortran common-related error recovery ICE.
Upon reverting a symbol in a common block (after throwing an error),
the compiler was ICEing because the symbol's common_block field was set,
but the symbol was not in the common block's list of symbols.
Fixed by both adding the symbol to the common block list and setting
the symbol's common_block field at the same time.
Furthermore, the gfc_add_in_common call is delayed and its result is
ignored, so that its error messages are ignored and the compiler has
the opportunity to give a better error message.
Another gfc_add_in_common call is added later during resolution
to emit again the missing errors.
PR fortran/67758
gcc/fortran/
* match.c (gfc_match_common): Delay the common_block pointer
assignment after error checking.
Delay the call to gfc_add_in_common attribute after the handling
of array specs.
* resolve.c (resolve_common_vars): Call gfc_add_in_common again.
gcc/testsuite/
* gfortran.dg/common_24.f: New.
From-SVN: r228457
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 614d8a9..e75c293 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -918,6 +918,12 @@ resolve_common_vars (gfc_common_head *common_block, bool named_common) for (; csym; csym = csym->common_next) { + /* gfc_add_in_common may have been called before, but the reported errors + have been ignored to continue parsing. + We do the checks again here. */ + if (!csym->attr.use_assoc) + gfc_add_in_common (&csym->attr, csym->name, &common_block->where); + if (csym->value || csym->attr.data) { if (!csym->ns->is_block_data) |