public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec
@ 2021-12-06 20:25 gscfq@t-online.de
2021-12-17 21:56 ` [Bug fortran/103590] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2021-12-06 20:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
Bug ID: 103590
Summary: ICE: find_array_spec(): Missing spec
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: ---
Affects versions down to at least r5 :
$ cat z1.f90
program p
associate (a => 1)
print *, [character(a(1)) :: '1']
end associate
end
$ cat z2.f90
program p
character :: b(1)
associate (a => 1)
b = [character(a(1)) :: '1']
end associate
end
$ gfortran-12-20211205 -c z1.f90
f951: internal compiler error: find_array_spec(): Missing spec
0x799179 gfc_report_diagnostic
../../gcc/fortran/error.c:874
0x79ace7 gfc_internal_error(char const*, ...)
../../gcc/fortran/error.c:1494
0x81c09f find_array_spec
../../gcc/fortran/resolve.c:4989
0x81c09f gfc_resolve_ref(gfc_expr*)
../../gcc/fortran/resolve.c:5331
0x80c167 resolve_variable
../../gcc/fortran/resolve.c:5842
0x80c167 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:7168
0x79f054 gfc_reduce_init_expr(gfc_expr*)
../../gcc/fortran/expr.c:3155
0x780562 char_len_param_value
../../gcc/fortran/decl.c:1129
0x7830b0 gfc_match_char_spec(gfc_typespec*)
../../gcc/fortran/decl.c:3541
0x7cd8c3 gfc_match_type_spec(gfc_typespec*)
../../gcc/fortran/match.c:2144
0x767b10 gfc_match_array_constructor(gfc_expr**)
../../gcc/fortran/array.c:1246
0x7d39a9 match_primary
../../gcc/fortran/matchexp.c:153
0x7d39a9 match_level_1
../../gcc/fortran/matchexp.c:211
0x7d39a9 match_mult_operand
../../gcc/fortran/matchexp.c:267
0x7d3c08 match_add_operand
../../gcc/fortran/matchexp.c:356
0x7d3e5c match_level_2
../../gcc/fortran/matchexp.c:480
0x7d3fb2 match_level_3
../../gcc/fortran/matchexp.c:551
0x7d40a4 match_level_4
../../gcc/fortran/matchexp.c:599
0x7d40a4 match_and_operand
../../gcc/fortran/matchexp.c:693
0x7d4292 match_or_operand
../../gcc/fortran/matchexp.c:722
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103590] ICE: find_array_spec(): Missing spec
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
@ 2021-12-17 21:56 ` pinskia at gcc dot gnu.org
2022-07-17 20:23 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17 21:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.9.4
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-12-17
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103590] ICE: find_array_spec(): Missing spec
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
2021-12-17 21:56 ` [Bug fortran/103590] " pinskia at gcc dot gnu.org
@ 2022-07-17 20:23 ` anlauf at gcc dot gnu.org
2022-07-18 20:44 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-17 20:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
Error recovery issue. Can be mitigated by e.g.:
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 2ebf076f730..be024d50c2e 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4976,7 +4976,7 @@ gfc_resolve_dim_arg (gfc_expr *dim)
static void
resolve_assoc_var (gfc_symbol* sym, bool resolve_target);
-static void
+static bool
find_array_spec (gfc_expr *e)
{
gfc_array_spec *as;
@@ -5004,7 +5004,11 @@ find_array_spec (gfc_expr *e)
{
case REF_ARRAY:
if (as == NULL)
- gfc_internal_error ("find_array_spec(): Missing spec");
+ {
+ gfc_error ("Symbol %qs at %L has not been declared as an array",
+ e->symtree->n.sym->name, &e->where);
+ return false;
+ }
ref->u.ar.as = as;
as = NULL;
@@ -5028,6 +5032,8 @@ find_array_spec (gfc_expr *e)
if (as != NULL)
gfc_internal_error ("find_array_spec(): unused as(2)");
+
+ return true;
}
@@ -5346,7 +5352,8 @@ gfc_resolve_ref (gfc_expr *expr)
for (ref = expr->ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY && ref->u.ar.as == NULL)
{
- find_array_spec (expr);
+ if (!find_array_spec (expr))
+ return false;
break;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103590] ICE: find_array_spec(): Missing spec
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
2021-12-17 21:56 ` [Bug fortran/103590] " pinskia at gcc dot gnu.org
2022-07-17 20:23 ` anlauf at gcc dot gnu.org
@ 2022-07-18 20:44 ` anlauf at gcc dot gnu.org
2022-07-19 21:28 ` cvs-commit at gcc dot gnu.org
2022-07-19 21:35 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-18 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2022-July/058003.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103590] ICE: find_array_spec(): Missing spec
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
` (2 preceding siblings ...)
2022-07-18 20:44 ` anlauf at gcc dot gnu.org
@ 2022-07-19 21:28 ` cvs-commit at gcc dot gnu.org
2022-07-19 21:35 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-19 21:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:f838d15641d256e21ffc126c3277b290ed743928
commit r13-1757-gf838d15641d256e21ffc126c3277b290ed743928
Author: Harald Anlauf <anlauf@gmx.de>
Date: Mon Jul 18 22:34:53 2022 +0200
Fortran: error recovery on invalid array reference of non-array [PR103590]
gcc/fortran/ChangeLog:
PR fortran/103590
* resolve.cc (find_array_spec): Change function result to bool to
enable error recovery. Generate error message for invalid array
reference of non-array entity instead of an internal error.
(gfc_resolve_ref): Use function result from find_array_spec for
error recovery.
gcc/testsuite/ChangeLog:
PR fortran/103590
* gfortran.dg/associate_54.f90: Adjust.
* gfortran.dg/associate_59.f90: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/103590] ICE: find_array_spec(): Missing spec
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
` (3 preceding siblings ...)
2022-07-19 21:28 ` cvs-commit at gcc dot gnu.org
@ 2022-07-19 21:35 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-19 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103590
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed for gcc-13.
Thanks for the report!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-19 21:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 20:25 [Bug fortran/103590] New: ICE: find_array_spec(): Missing spec gscfq@t-online.de
2021-12-17 21:56 ` [Bug fortran/103590] " pinskia at gcc dot gnu.org
2022-07-17 20:23 ` anlauf at gcc dot gnu.org
2022-07-18 20:44 ` anlauf at gcc dot gnu.org
2022-07-19 21:28 ` cvs-commit at gcc dot gnu.org
2022-07-19 21:35 ` anlauf 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).