https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113866
Bug ID: 113866
Summary: ice in generic_simplify_COND_EXPR
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Created attachment 57380
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57380&action=edit
F90 source code
For this F90 source code file:
./Lower/HLFIR/bindc-assumed-length.f90
from the flang testsuite at
https://github.com/llvm/llvm-project/tree/main/flang/test
when compiled by recent gfortran, does this:
est $ ~/gcc/results.20240210.asan.ubsan/bin/gfortran -c -w
./Lower/HLFIR/bindc-assumed-length.f90
./Lower/HLFIR/bindc-assumed-length.f90:39:29:
39 | call bindc_optional(c1, c3)
| 1
internal compiler error: Segmentation fault
0xf57d79 crash_signal(int)
/home/dcb38/gcc/working/gcc/../../trunk.20210101/gcc/toplev.cc:317
0x17bdf2f generic_simplify_COND_EXPR(unsigned int, tree_code, tree_node*,
tree_node*, tree_node*, tree_node*)
/home/dcb38/gcc/working/gcc/generic-match-4.cc:0
0xaecbf8 fold_ternary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node*)
Here is a valgrind version of the same gfortran providing some clues:
test $ ~/gcc/results.20240210.valgrind/bin/gfortran -c -w
./Lower/HLFIR/bindc-assumed-length.f90
==3757741== Invalid read of size 2
==3757741== at 0x17793EF: generic_simplify_COND_EXPR(unsigned int,
tree_code, tree_node*, tree_node*, tree_node*, tree_node*)
(generic-match-4.cc:10061)
==3757741== by 0xB082BB: fold_ternary_loc(unsigned int, tree_code,
tree_node*, tree_node*, tree_node*, tree_node*) (fold-const.cc:13144)