Hi,
I'd like to propose the attached patch (developed against GCC 15.2.0) as
a fix for the bug logged in PR target/112400.
When cross-compiling itself for VAX, GCC terminates abruptly with an ICE
when compiling gimple_match.cc; the root cause seems to be an
incompletely removed computed jump instruction, which causes the
assertion in cfgrtl.cc around line 4083, to no longer hold.
I have verified that the problem is present in GCC 15.2.0 and believe
that it's also present in trunk (based on the fact that the patterns for
the "casesi1" and "*casesi1" instructions in 15.2.0 and trunk are the same).
I've been able to generate a reduced input file from gimple_match.cc
which demonstrates the problem in GCC 15.2.0 on NetBSD/amd64
cross-compiling for vax; I've attached that input file to the problem
report. I'll need some help to turn that into a test in the GCC
testsuite, however.
(For completeness, I note that I do not have write access to the GCC tree.)
many thanks
kalvis
Wrap the limit operand in a (use ), to allow single_set() to
identify it as an RTL expression setting PC. This allows the
optimiser to optimise away case statements branching only to a
basic block
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
index c7b3d8a357a8..f23b5b144769 100644
--- a/gcc/config/vax/vax.md
+++ b/gcc/config/vax/vax.md
@@ -2948,7 +2948,7 @@
"#"
"reload_completed"
[(parallel
- [(match_dup 1)
+ [(use (match_dup 1))
(set (pc)
(plus:SI (sign_extend:SI
(mem:HI (plus:SI
@@ -2957,8 +2957,8 @@
"")
(define_insn "*casesi1"
- [(match_operand:SI 1 "const_int_operand" "n")
+ [(use (match_operand:SI 1 "const_int_operand" "n"))
(set (pc)
(plus:SI (sign_extend:SI
(mem:HI (plus:SI