On 2/6/2026 10:07 AM, Alexandre Oliva wrote:
On Feb 6, 2026, Jeffrey Law <[email protected]> wrote:
On 2/5/2026 9:26 PM, Alexandre Oliva wrote:
Unfortunately, it looks like riscv32-elf is not equivalent to
riscv64-elf with an explicit -march=*32*: I guess the -mcpu in the tests
overrides the base arch in the former case, but not in the latter.
Right. That's precisely what I'm referring to. IIRC we decided to be
compatible behavior-wise with LLVM on this and it's caused similar
surprises/headaches.
And I guess that overriding makes sense, but it suggests to me that the
tests were probably not testing what they were meant to test when -march
was overridden by --target_board settings. Resetting -march is probably
the simplest way for the tests to do their jobs consistently. It will
confirm the -mabi settings added recently, that made them incompatible
with rv32. If there is an intent of exercising these testcases with
rv32 arches and abis, we can go down the other path I suggested upthread
instead.
This change is not suited for backporting to gcc-15, because of the
reliance on -march=unset, not present in gcc-15. A potential backport
would have to name the desired architecture explicitly. -march=unset is
more desirable moving forward IMHO.
The tests fail when --target_board sets -march to a 32-bit
architecture. Override that -march by resetting it, so that the arch
implied by -mcpu prevails.
Tested on riscv32-elf, with and without -march overriders in
--target_board / TOOL_OPTIONS. Ok to install?
for gcc/testsuite/ChangeLog
* gcc.target/riscv/pr114139.c: Reset arch.
* gcc.target/riscv/pr118170.c: Likewise.
Sorry, yes, this slipped through the cracks. It's safe to install any
release that has the unset capability.
Jeff