Found this while setting up the risc-v coordination branch off of
gcc-15. Not sure why I didn't use rtvec_alloc directly here since we're
going to initialize the whole vector ourselves. Using gen_rtvec was
just wrong as it's walking down a non-existent varargs list. Under the
"right" circumstances it can walk off a page and fault.
This was seen with a test already in the testsuite (I forget which
test), so no new regression test.
Tested in my tester and verified the failure on the coordination branch
is resolved a well. Waiting on pre-commit CI to render a verdict.
jeff
gcc/
* config/riscv/riscv-vect-permconst.cc (vector_permconst:process_bb):
Use rtvec_alloc, not gen_rtvec since we don't want/need to initialize
the vector.
diff --git a/gcc/config/riscv/riscv-vect-permconst.cc
b/gcc/config/riscv/riscv-vect-permconst.cc
index 8e13cf8d558..087f26aea8a 100644
--- a/gcc/config/riscv/riscv-vect-permconst.cc
+++ b/gcc/config/riscv/riscv-vect-permconst.cc
@@ -227,7 +227,7 @@ vector_permconst::process_bb (basic_block bb)
normalize it to zero.
XXX This violates structure sharing conventions. */
- rtvec_def *nvec = gen_rtvec (CONST_VECTOR_NUNITS (cvec).to_constant ());
+ rtvec_def *nvec = rtvec_alloc (CONST_VECTOR_NUNITS (cvec).to_constant
());
for (i = 0; i < CONST_VECTOR_NUNITS (cvec).to_constant (); i++)
nvec->elem[i] = GEN_INT (INTVAL (CONST_VECTOR_ELT (cvec, i)) - bias);