https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119587
Bug ID: 119587
Summary: RISC-V: XTheadMemIdx: ICE on valid code with asm
operands
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: cmuellner at gcc dot gnu.org
Target Milestone: ---
Bohan Lei reported an ICE in a patch [1] to fix this ICE.
Reproducer:
// gcc -Ofast -march=rv64gc_xtheadmemidx
int a;
int **b;
int**
c ()
{
int **e = &b[(unsigned)(long)&a];
__asm__ ("" : "+A"(*e));
return 0;
}
Replacing "return 0" with "return e" avoids the ICE.
The underlying issue is that the combiner's output cannot
be lowered later on (which triggers the ICE in LRA).
Bohan's patch attempts to address the ICE with a splitter.
However, it has not yet been decided whether that's the right way.
Jeff Law has started a discussion in [2].
Since this has already become more than a simple fix, I'm opening a ticket
here.
[1] https://gcc.gnu.org/pipermail/gcc-patches/2025-March/678933.html
[2] https://gcc.gnu.org/pipermail/gcc-patches/2025-April/679950.html