[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 markeggleston at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status|REOPENED|RESOLVED --- Comment #12 from markeggleston at gcc dot gnu.org --- Committed to master.
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #11 from CVS Commits --- The master branch has been updated by Mark Eggleston : https://gcc.gnu.org/g:4d2a56a0f7135469587feacef44cf00e08f71d09 commit r11-3866-g4d2a56a0f7135469587feacef44cf00e08f71d09 Author: Mark Eggleston Date: Thu Jun 11 14:33:51 2020 +0100 Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier is not a module or a program. The original patch was modified to reject global identifiers that represent a module or a program. 2020-10-14 Steven G. Kargl Mark Eggleston gcc/fortran/ChangeLog: PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is a module or a program. 2020-10-14 Mark Eggleston gcc/testsuite/ChangeLog: PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. * gfortran.dg/pr95614_3.f90: New test. * gfortran.dg/pr95614_4.f90: New test.
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 markeggleston at gcc dot gnu.org changed: What|Removed |Added Resolution|FIXED |--- Status|RESOLVED|REOPENED --- Comment #10 from markeggleston at gcc dot gnu.org --- See 97224
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 markeggleston at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED CC||markeggleston at gcc dot gnu.org Resolution|--- |FIXED --- Comment #9 from markeggleston at gcc dot gnu.org --- Committed to master and backported.
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #8 from CVS Commits --- The releases/gcc-8 branch has been updated by Mark Eggleston : https://gcc.gnu.org/g:e28cc38ac34cb4de31b983f817c6e5f7dde55e2c commit r8-10539-ge28cc38ac34cb4de31b983f817c6e5f7dde55e2c Author: Mark Eggleston Date: Thu Jun 11 14:33:51 2020 +0100 Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl Mark Eggleston gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. (cherry picked from commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc)
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #7 from CVS Commits --- The releases/gcc-9 branch has been updated by Mark Eggleston : https://gcc.gnu.org/g:7a8c40bca889785fc4664e5e11c430e31d297696 commit r9-8942-g7a8c40bca889785fc4664e5e11c430e31d297696 Author: Mark Eggleston Date: Thu Jun 11 14:33:51 2020 +0100 Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl Mark Eggleston gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. (cherry picked from commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc)
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #6 from CVS Commits --- The releases/gcc-10 branch has been updated by Mark Eggleston : https://gcc.gnu.org/g:4a67941a956003dcce8866604ba25f5a0bfd16cf commit r10-8803-g4a67941a956003dcce8866604ba25f5a0bfd16cf Author: Mark Eggleston Date: Thu Jun 11 14:33:51 2020 +0100 Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl Mark Eggleston gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test. (cherry picked from commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc)
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #5 from CVS Commits --- The master branch has been updated by Mark Eggleston : https://gcc.gnu.org/g:e5a76af3a2f3324efc60b4b2778ffb29d5c377bc commit r11-3487-ge5a76af3a2f3324efc60b4b2778ffb29d5c377bc Author: Mark Eggleston Date: Thu Jun 11 14:33:51 2020 +0100 Fortran : ICE in build_field PR95614 Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl Mark Eggleston gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test.
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 --- Comment #4 from Steve Kargl --- On Mon, Jun 22, 2020 at 09:10:25AM +, drikosev at gmail dot com wrote: > > --- Comment #3 from Ev Drikos --- > > Hello, > > Perhaps, an additional check in file resolve.c might be necessary, or > one would have to adjust one-two "common*.f" test cases. > > Hope this helps, > Ev. Drikos Yes, indeed. Some testcases may need to be updated to account for the new error message or one may needs to use the old testcase to adjust the conditional to not trigger for the older testcase. Also, note that I've found invalid Fortran in testcases as I've fixed a bug. When parsing a file, gfortran runs a series of matchers. If a failure is detected in a matcher an error message is queued, and then other matchers are run. If no matcher succeeds in matching a statement, the last queued error message(s) is(are) emitted and gfortran will exit. If a matcher does match a statement, then the error queue is cleared and the next statement is parsed. Sometimes a new patch will find invalid Fortran in the testsuite.
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 Ev Drikos changed: What|Removed |Added CC||drikosev at gmail dot com --- Comment #3 from Ev Drikos --- Hello, Perhaps, an additional check in file resolve.c might be necessary, or one would have to adjust one-two "common*.f" test cases. Hope this helps, Ev. Drikos -- if (gsym && gsym->type != GSYM_UNKNOWN && gsym->type != GSYM_COMMON) + gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name); + if (gsym && gsym->type != GSYM_UNKNOWN) + gfc_error_now ("Global entity %qs at %L cannot appear in a " + "COMMON block at %L", gsym->name, + >where, >common_block->where); +
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #2 from kargl at gcc dot gnu.org --- Index: gcc/fortran/decl.c === --- gcc/fortran/decl.c (revision 280157) +++ gcc/fortran/decl.c (working copy) @@ -5924,7 +5924,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, _sym); } - else if (match_common_name (name) == MATCH_YES) + else if (gfc_match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); @@ -5969,7 +5969,7 @@ get_bind_c_idents (void) found_id = MATCH_YES; gfc_get_ha_symbol (name, _sym); } - else if (match_common_name (name) == MATCH_YES) + else if (gfc_match_common_name (name) == MATCH_YES) { found_id = MATCH_YES; com_block = gfc_get_common (name, 0); Index: gcc/fortran/match.c === --- gcc/fortran/match.c (revision 280157) +++ gcc/fortran/match.c (working copy) @@ -5122,7 +5122,8 @@ gfc_get_common (const char *name, int from_module) /* Match a common block name. */ -match match_common_name (char *name) +match +gfc_match_common_name (char *name) { match m; @@ -5174,7 +5175,7 @@ gfc_match_common (void) for (;;) { - m = match_common_name (name); + m = gfc_match_common_name (name); if (m == MATCH_ERROR) goto cleanup; Index: gcc/fortran/match.h === --- gcc/fortran/match.h (revision 280157) +++ gcc/fortran/match.h (working copy) @@ -103,11 +103,8 @@ match gfc_match_call (void); /* We want to use this function to check for a common-block-name that can exist in a bind statement, so removed the "static" - declaration of the function in match.c. - - TODO: should probably rename this now that it'll be globally seen to - gfc_match_common_name. */ -match match_common_name (char *name); + declaration of the function in match.c. */ +match gfc_match_common_name (char *name); match gfc_match_common (void); match gfc_match_block_data (void); Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (revision 280157) +++ gcc/fortran/resolve.c (working copy) @@ -936,9 +936,16 @@ static void resolve_common_vars (gfc_common_head *common_block, bool named_common) { gfc_symbol *csym = common_block->head; + gfc_gsymbol *gsym; for (; csym; csym = csym->common_next) { + gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name); + if (gsym && gsym->type != GSYM_UNKNOWN) + gfc_error_now ("Global entity %qs at %L cannot appear in a " + "COMMON block at %L", gsym->name, + >where, >common_block->where); + /* 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. */
[Bug fortran/95614] ICE in build_field, at fortran/trans-common.c:301
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95614 Dominique d'Humieres changed: What|Removed |Added Last reconfirmed||2020-06-09 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Dominique d'Humieres --- Confirmed.