[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2019-04-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Dominique d'Humieres  ---
Fixed.

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2019-04-03 Thread dominiq at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #9 from dominiq at gcc dot gnu.org ---
Author: dominiq
Date: Wed Apr  3 21:32:13 2019
New Revision: 270137

URL: https://gcc.gnu.org/viewcvs?rev=270137=gcc=rev
Log:
2019-04-03  Steven G. Kargl  

PR fortran/68567
* expr.c (gfc_reduce_init_expr): Add extra check to avoid
dereferencing a null pointer.

2019-04-03  Dominique d'Humieres  

PR fortran/68567
* gfortran.dg/parameter_array_error_1.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/parameter_array_error_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2019-04-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #8 from Dominique d'Humieres  ---
Packaging submitted at https://gcc.gnu.org/ml/fortran/2019-04/msg7.html.

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2019-04-02 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #7 from Dominique d'Humieres  ---
For the record, the tests in comment 1 compile without ICE since GCC6.

Unless someone beats me, I am planning to package the patch in comment 4 and
submit it to the mailing lists.

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2018-03-08 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

Harald Anlauf  changed:

   What|Removed |Added

 CC||anlauf at gmx dot de

--- Comment #6 from Harald Anlauf  ---
The patch in comment #4 still applies (with some offset).

Is there anything left to do?

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2016-11-21 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

Jeffrey A. Law  changed:

   What|Removed |Added

   Priority|P3  |P4
 CC||law at redhat dot com

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2016-08-23 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #5 from Gerhard Steinmetz  
---
> We must be using drastically different compilers.
No, I've simply forgotten to include a subcatalog with testfiles zz*.
Sorry for my blotchiness. The patch looks good and works.

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2016-08-22 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #3)
> ICE is gone for all tested constellations with
> gcc-Version 7.0.0 20160821 (experimental) (GCC)

We must be using drastically different compilers.  With your

% cat a.f90
program p
   integer, parameter :: a(:) = [2, 1]
   integer :: b = a(a(1))
end

I get an ICE.

% gfc6 -o z a.f90
f951: internal compiler error: Segmentation fault
0xa53fff crash_signal
../../gcc6/gcc/toplev.c:333
0x5da9e3 gfc_reduce_init_expr(gfc_expr*)
../../gcc6/gcc/fortran/expr.c:2676
0x5dae33 find_array_element
../../gcc6/gcc/fortran/expr.c:1206

With the obvious simple patch,

% svn diff gcc/fortran/expr.c 
Index: gcc/fortran/expr.c
===
--- gcc/fortran/expr.c  (revision 239661)
+++ gcc/fortran/expr.c  (working copy)
@@ -2670,7 +2670,7 @@ gfc_reduce_init_expr (gfc_expr *expr)
 t = gfc_check_init_expr (expr);
   gfc_init_expr_flag = false;

-  if (!t)
+  if (!t || !expr)
 return false;

   if (expr->expr_type == EXPR_ARRAY)

I get

% gfc7 -o z a.f90
a.f90:3:3:

integer :: b = a(a(1))
   1
Error: Unclassifiable statement at (1)
a.f90:2:29:

integer, parameter :: a(:) = [2, 1]
 1
Error: Parameter array 'a' at (1) cannot be automatic or of deferred shape

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2016-08-22 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #3 from Gerhard Steinmetz  
---
ICE is gone for all tested constellations with
gcc-Version 7.0.0 20160821 (experimental) (GCC)

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2015-11-26 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-11-26
 Ever confirmed|0   |1

--- Comment #2 from Dominique d'Humieres  ---
Confirmed from 4.8 up to trunk (6.0).

Backtrace

Program received signal SIGSEGV, Segmentation fault.
gfc_reduce_init_expr (expr=0x0) at ../../_clean/gcc/fortran/expr.c:2676
2676  if (expr->expr_type == EXPR_ARRAY)
(gdb) bt
#0  gfc_reduce_init_expr (expr=warning: (Internal error: pc 0x0 in read in
psymtab, but not in symtab.)

0x0) at ../../_clean/gcc/fortran/expr.c:2676
#1  0x000100036aa9 in simplify_const_ref (p=0x14221db60) at
../../_clean/gcc/fortran/expr.c:1206
#2  0x00010003759f in gfc_simplify_expr (p=0x14221db60, type=0) at
../../_clean/gcc/fortran/expr.c:1922
#3  0x0001000376ae in simplify_parameter_variable (p=0x14221d930, type=0)
at ../../_clean/gcc/fortran/expr.c:1787
#4  0x000100037581 in gfc_simplify_expr (p=0x14221d930, type=0) at
../../_clean/gcc/fortran/expr.c:1894
#5  0x0001000377b3 in simplify_ref_chain (ref=0x14221d490, type=0) at
../../_clean/gcc/fortran/expr.c:1746
#6  0x000100037069 in gfc_simplify_expr (p=0x14221d3d0, type=0) at
../../_clean/gcc/fortran/expr.c:1912
#7  0x0001000376ae in simplify_parameter_variable (p=0x14221ceb0, type=0)
at ../../_clean/gcc/fortran/expr.c:1787
#8  0x000100036748 in gfc_reduce_init_expr (expr=0x14221ceb0) at
../../_clean/gcc/fortran/expr.c:2670
#9  0x00010003781a in gfc_match_init_expr (result=0x7fff5fbfed88) at
../../_clean/gcc/fortran/expr.c:2709
#10 0x00010001f8b5 in match_data_constant (result=) at
../../_clean/gcc/fortran/decl.c:408
#11 0x00010001f9a5 in top_val_list (data=) at
../../_clean/gcc/fortran/decl.c:446
#12 0x00010001fbf9 in gfc_match_data () at
../../_clean/gcc/fortran/decl.c:575
#13 0x00010007fdaa in match_word_omp_simd (subr=,
old_locus=, simd_matched=, str=)
at ../../_clean/gcc/fortran/parse.c:93
#14 0x000100083b90 in decode_statement () at
../../_clean/gcc/fortran/parse.c:461
#15 0x000100085125 in next_statement () at
../../_clean/gcc/fortran/parse.c:1074
#16 0x00010008691d in parse_spec (st=) at
../../_clean/gcc/fortran/parse.c:3344
#17 0x00010008a4f7 in parse_progunit (st=) at
../../_clean/gcc/fortran/parse.c:5126
#18 0x00010008bdd2 in gfc_parse_file () at
../../_clean/gcc/fortran/parse.c:5635
#19 0x0001000d2756 in gfc_be_parse_file () at
../../_clean/gcc/fortran/f95-lang.c:199
#20 0x00010098f9ea in compile_file () at ../../_clean/gcc/toplev.c:464
#21 0x000100d8c9c3 in ?? ()
#22 0x000100d8e389 in main (argc=2, argv=0x7fff5fbff308) at
../../_clean/gcc/main.c:39

[Bug fortran/68567] ICE on using wrong defined arrays (different cases/messages)

2015-11-26 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68567

--- Comment #1 from Gerhard Steinmetz  
---
$ cat z1.f90
program p
   integer, parameter :: a(2.,2) = 1
   integer, parameter :: b(2) = a(1:2, 2)
end

$ gfortran -g -O0 -Wall -fcheck=all z1.f90
f951: internal compiler error: compare_bound_int(): Bad expression

---

$ cat z2.f90
program p
   integer :: i
   integer, parameter :: a('',2) = 1
   integer, parameter :: b(4) = [a(1:2, 2), a(1:2, 1)]
end

$ gfortran -g -O0 -Wall -fcheck=all z2.f90
f951: internal compiler error: compare_bound_int(): Bad expression