* [Bug fortran/56852] [4.6/4.7/4.8/4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
@ 2013-04-06 9:33 ` dominiq at lps dot ens.fr
2013-04-07 11:48 ` mikael at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-04-06 9:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-04-06
Summary|ICE on invalid: "Bad array |[4.6/4.7/4.8/4.9
|reference" for an |Regression] ICE on invalid:
|undeclared loop variable |"Bad array reference" for
| |an undeclared loop variable
Ever Confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-04-06 09:33:10 UTC ---
Confirmed. Revision 164285 (2010-09-14) gives the error
pr56852.f90:5.14:
read(0) (a(i),i=1,4)
1
Error: Symbol 'i' at (1) has no IMPLICIT type
without ICE. Revision 164728 (2010-09-29) gives the same error plus the ICE
program test
1
Internal Error at (1):
gfc_variable_attr(): Bad array reference
Backtrace for revision 197238
#0 gfc_variable_attr (expr=0x141a141d0, ts=0x0) at
../../_clean/gcc/fortran/primary.c:2135
#1 0x00000001000863b0 in gfc_expr_attr (e=<value optimized out>) at
../../_clean/gcc/fortran/primary.c:2267
#2 0x000000010003c5f9 in gfc_check_vardef_context (e=0x141a141d0,
pointer=false, alloc_obj=<value optimized out>, own_scope=<value optimized
out>,
context=0x100b3949f "item in READ") at ../../_clean/gcc/fortran/expr.c:4706
#3 0x000000010009cc2d in resolve_code (code=<value optimized out>, ns=<value
optimized out>) at ../../_clean/gcc/fortran/resolve.c:8150
#4 0x000000010009a90c in gfc_resolve_blocks (b=<value optimized out>,
ns=<value optimized out>) at ../../_clean/gcc/fortran/resolve.c:8885
#5 0x000000010009adc2 in resolve_code (code=<value optimized out>, ns=<value
optimized out>) at ../../_clean/gcc/fortran/resolve.c:9557
#6 0x000000010009a90c in gfc_resolve_blocks (b=<value optimized out>,
ns=<value optimized out>) at ../../_clean/gcc/fortran/resolve.c:8885
#7 0x000000010009adc2 in resolve_code (code=<value optimized out>, ns=<value
optimized out>) at ../../_clean/gcc/fortran/resolve.c:9557
#8 0x000000010009dab4 in resolve_codes (ns=<value optimized out>) at
../../_clean/gcc/fortran/resolve.c:14411
#9 0x000000010008e1bd in gfc_resolve (ns=<value optimized out>) at
../../_clean/gcc/fortran/resolve.c:14439
#10 0x00000001000825db in gfc_parse_file () at
../../_clean/gcc/fortran/parse.c:4399
#11 0x00000001000c25c6 in gfc_be_parse_file () at
../../_clean/gcc/fortran/f95-lang.c:189
#12 0x000000010076ce94 in compile_file () at ../../_clean/gcc/toplev.c:543
#13 0x000000010076ef69 in toplev_main (argc=2, argv=0x7fff5fbfd7c8) at
../../_clean/gcc/toplev.c:1864
#14 0x0000000100009b54 in start (pc=<value optimized out>, bases=0x0) at
../../../_clean/libgcc/config/unwind-dw2-fde-darwin.c:272
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.6/4.7/4.8/4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
2013-04-06 9:33 ` [Bug fortran/56852] [4.6/4.7/4.8/4.9 Regression] " dominiq at lps dot ens.fr
@ 2013-04-07 11:48 ` mikael at gcc dot gnu.org
2013-05-15 13:27 ` [Bug fortran/56852] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-04-07 11:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> 2013-04-07 11:47:58 UTC ---
There is a simple fix, may be too big hammer:
diff --git a/resolve.c b/resolve.c
index 835b57f..0b44c98 100644
--- a/resolve.c
+++ b/resolve.c
@@ -14426,6 +14426,7 @@ gfc_resolve (gfc_namespace *ns)
{
gfc_namespace *old_ns;
code_stack *old_cs_base;
+ int errors;
if (ns->resolved)
return;
@@ -14435,6 +14436,9 @@ gfc_resolve (gfc_namespace *ns)
old_cs_base = cs_base;
resolve_types (ns);
+ gfc_get_errors (NULL, &errors);
+ if (errors > 0)
+ return;
component_assignment_level = 0;
resolve_codes (ns);
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.7/4.8/4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
2013-04-06 9:33 ` [Bug fortran/56852] [4.6/4.7/4.8/4.9 Regression] " dominiq at lps dot ens.fr
2013-04-07 11:48 ` mikael at gcc dot gnu.org
@ 2013-05-15 13:27 ` rguenth at gcc dot gnu.org
2014-06-12 13:41 ` [Bug fortran/56852] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-15 13:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.7/4.8/4.9/4.10 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (2 preceding siblings ...)
2013-05-15 13:27 ` [Bug fortran/56852] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
@ 2014-06-12 13:41 ` rguenth at gcc dot gnu.org
2014-12-19 13:25 ` [Bug fortran/56852] [4.8/4.9/5 " jakub at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.4 |4.8.4
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The 4.7 branch is being closed, moving target milestone to 4.8.4.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.8/4.9/5 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (3 preceding siblings ...)
2014-06-12 13:41 ` [Bug fortran/56852] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
@ 2014-12-19 13:25 ` jakub at gcc dot gnu.org
2015-02-18 13:29 ` dominiq at lps dot ens.fr
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.4 |4.8.5
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.8/4.9/5 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (4 preceding siblings ...)
2014-12-19 13:25 ` [Bug fortran/56852] [4.8/4.9/5 " jakub at gcc dot gnu.org
@ 2015-02-18 13:29 ` dominiq at lps dot ens.fr
2015-04-09 7:41 ` pault at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-18 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> There is a simple fix, may be too big hammer:
> ...
The patch in comment 3 fixes the ICE, bur breaks many tests (700+) for error:
FAIL: gfortran.dg/abstract_type_3.f03 -O (test for errors, line 44)
FAIL: gfortran.dg/abstract_type_6.f03 -O (test for errors, line 43)
FAIL: gfortran.dg/advance_3.f90 -O (test for errors, line 8)
FAIL: gfortran.dg/alloc_comp_constraint_1.f90 -O (test for errors, line 18)
FAIL: gfortran.dg/alloc_comp_constraint_1.f90 -O (test for errors, line 20)
FAIL: gfortran.dg/allocate_alloc_opt_1.f90 -O (test for errors, line 19)
...
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.8/4.9/5 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (5 preceding siblings ...)
2015-02-18 13:29 ` dominiq at lps dot ens.fr
@ 2015-04-09 7:41 ` pault at gcc dot gnu.org
2015-06-23 8:15 ` [Bug fortran/56852] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pault at gcc dot gnu.org @ 2015-04-09 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org
--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
Posted patch on list
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.8/4.9/5/6 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (6 preceding siblings ...)
2015-04-09 7:41 ` pault at gcc dot gnu.org
@ 2015-06-23 8:15 ` rguenth at gcc dot gnu.org
2015-06-26 19:52 ` [Bug fortran/56852] [4.9/5/6 " jakub at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-23 8:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.5 |4.9.3
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.9/5/6 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (7 preceding siblings ...)
2015-06-23 8:15 ` [Bug fortran/56852] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
@ 2015-06-26 19:52 ` jakub at gcc dot gnu.org
2015-06-26 20:26 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.9/5/6 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (8 preceding siblings ...)
2015-06-26 19:52 ` [Bug fortran/56852] [4.9/5/6 " jakub at gcc dot gnu.org
@ 2015-06-26 20:26 ` jakub at gcc dot gnu.org
2015-10-19 5:07 ` [Bug fortran/56852] [4.9 " pault at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.3 |4.9.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (9 preceding siblings ...)
2015-06-26 20:26 ` jakub at gcc dot gnu.org
@ 2015-10-19 5:07 ` pault at gcc dot gnu.org
2015-10-19 19:33 ` pault at gcc dot gnu.org
2015-10-19 19:36 ` pault at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-19 5:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.9/5 Regression] ICE on |[4.9 Regression] ICE on
|invalid: "Bad array |invalid: "Bad array
|reference" for an |reference" for an
|undeclared loop variable |undeclared loop variable
--- Comment #11 from Paul Thomas <pault at gcc dot gnu.org> ---
I have just applied the patch to the 4.9 tree and, if it regtests OK, I will
commit tonight.
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (10 preceding siblings ...)
2015-10-19 5:07 ` [Bug fortran/56852] [4.9 " pault at gcc dot gnu.org
@ 2015-10-19 19:33 ` pault at gcc dot gnu.org
2015-10-19 19:36 ` pault at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-19 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
--- Comment #12 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Mon Oct 19 19:32:52 2015
New Revision: 229000
URL: https://gcc.gnu.org/viewcvs?rev=229000&root=gcc&view=rev
Log:
2013-10-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/56852
* primary.c (gfc_variable_attr): Avoid ICE on AR_UNKNOWN if any
of the index variables are untyped and errors are present.
2013-10-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/56852
* gfortran.dg/pr56852.f90 : New test
Added:
branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/pr56852.f90
Modified:
branches/gcc-4_9-branch/gcc/fortran/ChangeLog
branches/gcc-4_9-branch/gcc/fortran/primary.c
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/56852] [4.9 Regression] ICE on invalid: "Bad array reference" for an undeclared loop variable
2013-04-05 23:12 [Bug fortran/56852] New: ICE on invalid: "Bad array reference" for an undeclared loop variable bugs at stellardeath dot org
` (11 preceding siblings ...)
2015-10-19 19:33 ` pault at gcc dot gnu.org
@ 2015-10-19 19:36 ` pault at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-19 19:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56852
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #13 from Paul Thomas <pault at gcc dot gnu.org> ---
Sorry about the long delay in closing this PR. I have been heavily distracted
by the likes of submodules.
Thanks for the report.
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread