https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92019
Bug ID: 92019
Summary: [10 Regression] ICE in find_inquiry_ref, at
expr.c:1790
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Errors in z4/z3 are detected, z2 is silently accepted and z1 ICEs :
(also with a(z'1'))
$ cat z4.f90
program p
character, parameter :: a(2) = 'a'
integer :: b = a(3)%kind
end
$ gfortran-10-20191006 -c z4.f90
z4.f90:3:20:
3 | integer :: b = a(3)%kind
| 1
Warning: Array reference at (1) is out of bounds (3 > 2) in dimension 1
---
$ cat z3.f90
program p
character, parameter :: a(2) = 'a'
integer :: b = a(z'3')
end
$ gfortran-10-20191006 -c z3.f90
z3.f90:3:20:
3 | integer :: b = a(z'3')
| 1
Error: Array index at (1) must be of INTEGER type, found BOZ
---
$ cat z2.f90
program p
character, parameter :: a(2) = 'a'
integer :: b = a(z'3')%kind
print *, b
end
$ gfortran-10-20191006 z2.f90 && ./a.out
1
---
$ cat z1.f90
program p
character, parameter :: a(2) = 'a'
integer :: b = a(z'3')%len
end
$ gfortran-9 -c z1.f90
z1.f90:3:20:
3 | integer :: b = a(z'3')%len
| 1
Warning: Array reference at (1) is out of bounds (3 > 2) in dimension 1
$ gfortran-10-20191006 -c z1.f90
f951: internal compiler error: Segmentation fault
0xcdaddf crash_signal
../../gcc/toplev.c:326
0x64f4af find_inquiry_ref
../../gcc/fortran/expr.c:1790
0x6528cd simplify_ref_chain
../../gcc/fortran/expr.c:2023
0x65202d gfc_simplify_expr(gfc_expr*, int)
../../gcc/fortran/expr.c:2227
0x6527cc simplify_parameter_variable
../../gcc/fortran/expr.c:2072
0x6525cd gfc_simplify_expr(gfc_expr*, int)
../../gcc/fortran/expr.c:2209
0x6ad18f gfc_match_varspec(gfc_expr*, int, bool, bool)
../../gcc/fortran/primary.c:2337
0x6aec2e gfc_match_rvalue(gfc_expr**)
../../gcc/fortran/primary.c:3484
0x68562e match_primary
../../gcc/fortran/matchexp.c:157
0x68562e match_level_1
../../gcc/fortran/matchexp.c:211
0x68562e match_mult_operand
../../gcc/fortran/matchexp.c:267
0x685878 match_add_operand
../../gcc/fortran/matchexp.c:356
0x685acc match_level_2
../../gcc/fortran/matchexp.c:480
0x685c22 match_level_3
../../gcc/fortran/matchexp.c:551
0x685d14 match_level_4
../../gcc/fortran/matchexp.c:599
0x685d14 match_and_operand
../../gcc/fortran/matchexp.c:693
0x685f02 match_or_operand
../../gcc/fortran/matchexp.c:722
0x685fd2 match_equiv_operand
../../gcc/fortran/matchexp.c:765
0x6860a4 match_level_5
../../gcc/fortran/matchexp.c:811
0x685481 gfc_match_expr(gfc_expr**)
../../gcc/fortran/matchexp.c:870