public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103507] New: ICE in resolve_block_construct, at fortran/resolve.c:10787
@ 2021-11-30 18:50 gscfq@t-online.de
2021-12-01 9:29 ` [Bug fortran/103507] " marxin at gcc dot gnu.org
2021-12-01 15:00 ` kargl at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: gscfq@t-online.de @ 2021-11-30 18:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103507
Bug ID: 103507
Summary: ICE in resolve_block_construct, at
fortran/resolve.c:10787
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Seems to have started with r6 :
$ cat z1.f90
subroutine s
block
end if
end
program p
end
$ cat z2.f90
subroutine s
block
end do
end
program p
end
$ cat z4.f90
subroutine s(x)
block
end if
end
end
$ cat z5.f90
subroutine s(x)
block
end subroutine
end
end
$ gfortran-12-20211128 -c z1.f90
z1.f90:3:3:
3 | end if
| 1
Error: Expecting END BLOCK statement at (1)
z1.f90:5:9:
5 | program p
| 1
Error: Unexpected PROGRAM statement at (1)
f951: internal compiler error: Segmentation fault
0xf0942f crash_signal
../../gcc/toplev.c:322
0x853098 gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:17556
0x853098 resolve_block_construct
../../gcc/fortran/resolve.c:10787
0x853098 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc/fortran/resolve.c:12182
0x854f97 resolve_codes
../../gcc/fortran/resolve.c:17536
0x85505e gfc_resolve(gfc_namespace*)
../../gcc/fortran/resolve.c:17571
0x83d314 resolve_all_program_units
../../gcc/fortran/parse.c:6573
0x83d314 gfc_parse_file()
../../gcc/fortran/parse.c:6829
0x88b37f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:216
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/103507] ICE in resolve_block_construct, at fortran/resolve.c:10787
2021-11-30 18:50 [Bug fortran/103507] New: ICE in resolve_block_construct, at fortran/resolve.c:10787 gscfq@t-online.de
@ 2021-12-01 9:29 ` marxin at gcc dot gnu.org
2021-12-01 15:00 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-01 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103507
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-12-01
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
All compilers I have do ICE (4.8.0+).
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/103507] ICE in resolve_block_construct, at fortran/resolve.c:10787
2021-11-30 18:50 [Bug fortran/103507] New: ICE in resolve_block_construct, at fortran/resolve.c:10787 gscfq@t-online.de
2021-12-01 9:29 ` [Bug fortran/103507] " marxin at gcc dot gnu.org
@ 2021-12-01 15:00 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-12-01 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103507
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
This patch prevents the ICE, but is not as elegant as I would like.
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index f074a0ab3a1..08f657407da 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -17553,6 +17553,14 @@ gfc_resolve (gfc_namespace *ns)
code_stack *old_cs_base;
struct gfc_omp_saved_state old_omp_state;
+ if (!ns)
+ {
+ int ecnt;
+ gfc_get_errors (NULL, &ecnt);
+ if (ecnt > 0)
+ gfc_fatal_error ("Namespace corruption due to previous errors");
+ }
+
if (ns->resolved)
return;
The problem seems to be with one of more namespaces being
incomplete and/or overlapping.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-01 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 18:50 [Bug fortran/103507] New: ICE in resolve_block_construct, at fortran/resolve.c:10787 gscfq@t-online.de
2021-12-01 9:29 ` [Bug fortran/103507] " marxin at gcc dot gnu.org
2021-12-01 15:00 ` kargl at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).