[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

Thomas Koenig  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Thomas Koenig  ---
Fixed, closing. Thanks for the bug report!

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

--- Comment #7 from Thomas Koenig  ---
Author: tkoenig
Date: Fri Mar 30 09:58:35 2018
New Revision: 258974

URL: https://gcc.gnu.org/viewcvs?rev=258974=gcc=rev
Log:

2017-03-30  Thomas Koenig  

PR fortran/85111
* array.c (gfc_resolve_character_array_constructor): Early
exit for zero-size arrays.
* simplify.c (simplify_transformation_to_array): Exit early
if the result size is zero.
(simplify_minmaxloc_to_array): Likewise.

2017-03-30  Thomas Koenig  

PR fortran/85111
* gfortran.dg/zero_sized_10.f90: New test.

Add ChangeLog entries for r258973.


Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/testsuite/ChangeLog

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

--- Comment #6 from Thomas Koenig  ---
Author: tkoenig
Date: Fri Mar 30 09:56:46 2018
New Revision: 258973

URL: https://gcc.gnu.org/viewcvs?rev=258973=gcc=rev
Log:
2017-03-30  Thomas Koenig  

PR fortran/85111
* array.c (gfc_resolve_character_array_constructor): Early
exit for zero-size arrays.
* simplify.c (simplify_transformation_to_array): Exit early
if the result size is zero.
(simplify_minmaxloc_to_array): Likewise.

2017-03-30  Thomas Koenig  

PR fortran/85111
* gfortran.dg/zero_sized_10.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/zero_sized_10.f90
Modified:
trunk/gcc/fortran/array.c
trunk/gcc/fortran/simplify.c

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-29 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

Thomas Koenig  changed:

   What|Removed |Added

   Keywords|accepts-invalid |patch

--- Comment #5 from Thomas Koenig  ---
Actually, having more elements in RESHAPE is OK.

Patch at https://gcc.gnu.org/ml/fortran/2018-03/msg00205.html .

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-29 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

Thomas Koenig  changed:

   What|Removed |Added

   Keywords||accepts-invalid,
   ||ice-on-invalid-code

--- Comment #4 from Thomas Koenig  ---
Two problems here: The invalid reshape is accepted, and this
causes a subsequent ICE.

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-28 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |tkoenig at gcc dot 
gnu.org

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-03-28
 CC||tkoenig at gcc dot gnu.org
  Known to work||7.3.0
   Target Milestone|--- |8.0
 Ever confirmed|0   |1
  Known to fail||8.0.1

--- Comment #3 from Dominique d'Humieres  ---
Likely revision r256088 for the tests in comments 0 and 1.

With r256065 and before I get

pr85111.f90:3:31:

integer, parameter :: b(2) = maxloc(a, dim=1)
   1
Error: transformational intrinsic 'maxloc' at (1) is not permitted in an
initialization expression

For the test in comment 2, it likely r255542.

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-28 Thread gs...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

--- Comment #2 from G. Steinmetz  ---

Changed between 20171210 and 20171217.


$ cat ze1.f90
program p
   character, parameter :: a(2,0) = reshape(['a','b','c','d'], shape(a))
   character, parameter :: b(2) = maxval(a, dim=1)
end


$ gfortran-8-20180325 -c ze1.f90
f951: internal compiler error: in gfc_resolve_character_array_constructor, at
fortran/array.c:2050
0x67a8a0 gfc_resolve_character_array_constructor(gfc_expr*)
../../gcc/fortran/array.c:2050
0x70f217 fixup_charlen
../../gcc/fortran/resolve.c:5744
0x70f217 gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:6780
0x6aad1f gfc_reduce_init_expr(gfc_expr*)
../../gcc/fortran/expr.c:2773
0x6ad821 gfc_match_init_expr(gfc_expr**)
../../gcc/fortran/expr.c:2821
0x69b2c2 variable_decl
../../gcc/fortran/decl.c:2642
0x69b2c2 gfc_match_data_decl()
../../gcc/fortran/decl.c:5838
0x6f60b9 match_word_omp_simd
../../gcc/fortran/parse.c:93
0x6f97ae match_word
../../gcc/fortran/parse.c:376
0x6f97ae decode_statement
../../gcc/fortran/parse.c:376
0x6fb6d4 next_free
../../gcc/fortran/parse.c:1230
0x6fb6d4 next_statement
../../gcc/fortran/parse.c:1462
0x6fcfcc parse_spec
../../gcc/fortran/parse.c:3854
0x6ff4b3 parse_progunit
../../gcc/fortran/parse.c:5667
0x700a94 gfc_parse_file()
../../gcc/fortran/parse.c:6207
0x74791f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:204

[Bug fortran/85111] [8 Regression] ICE in min_max_choose, at fortran/simplify.c:4884 (and others)

2018-03-28 Thread gs...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85111

--- Comment #1 from G. Steinmetz  ---

$ cat zc1.f90
program p
   integer, parameter :: a(2,0) = reshape([1,2,3,4], shape(a))
   integer, parameter :: b(2) = maxloc(shape(a))
end


$ cat zc7.f90
program p
   character, parameter :: a(2,0) = reshape(['a','b','c','d'], shape(a))
   character, parameter :: b(2) = maxloc(shape(a))
end


$ gfortran-8-20180325 -c zc1.f90
f951: internal compiler error: Segmentation fault
0xb9c38f crash_signal
../../gcc/toplev.c:325
0x725201 simplify_minmaxloc_nodim
../../gcc/fortran/simplify.c:5133
0x72dfe7 gfc_simplify_minmaxloc(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*,
int)
../../gcc/fortran/simplify.c:5418
0x6b99e3 do_simplify
../../gcc/fortran/intrinsic.c:4442
0x6c408c gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc/fortran/intrinsic.c:4798
0x70de35 resolve_unknown_f
../../gcc/fortran/resolve.c:2870
0x70de35 resolve_function
../../gcc/fortran/resolve.c:3179
0x70df5a gfc_resolve_expr(gfc_expr*)
../../gcc/fortran/resolve.c:6709
0x6aad1f gfc_reduce_init_expr(gfc_expr*)
../../gcc/fortran/expr.c:2773
0x6ad821 gfc_match_init_expr(gfc_expr**)
../../gcc/fortran/expr.c:2821
0x69b2c2 variable_decl
../../gcc/fortran/decl.c:2642
0x69b2c2 gfc_match_data_decl()
../../gcc/fortran/decl.c:5838
0x6f60b9 match_word_omp_simd
../../gcc/fortran/parse.c:93
0x6f97ae match_word
../../gcc/fortran/parse.c:376
0x6f97ae decode_statement
../../gcc/fortran/parse.c:376
0x6fb6d4 next_free
../../gcc/fortran/parse.c:1230
0x6fb6d4 next_statement
../../gcc/fortran/parse.c:1462
0x6fcfcc parse_spec
../../gcc/fortran/parse.c:3854
0x6ff4b3 parse_progunit
../../gcc/fortran/parse.c:5667
0x700a94 gfc_parse_file()
../../gcc/fortran/parse.c:6207