[Bug target/101697] [11/12/13 regression] ICE compiling uClibc-ng for h8300-linux

law at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Oct 16 19:19:39 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101697

--- Comment #6 from Jeffrey A. Law <law at gcc dot gnu.org> ---
So this issue has come up again in the context of LRA conversion which happens
to trip over the same bug, but with a different testcase.

At the core of this problem is reload and LRA will both generate invalid RTL
when performing register eliminations.  Specifically, they will create an
autoinc addressing mode where the incremented/decremented register is used
elsewhere in the same insn as a source operand.  Such RTL has been considered
invalid as long as I can remember.

The H8 backend does try to prevent this behavior by checking for this scenario
and rejecting such insns in the insn condition.  But in both the reload and LRA
cases, they make substitutions in the original insn without validating the
resulting insn (which would have failed).  Even if they did try to validate the
resulting insn, neither has a code generation strategy to deal with a failed
substitution during register eliminations.

Paul K. indicated how the pdp11 port handles these cases with constraints. 
Using constraints alone was insufficient to fix this problem, but using
constraints in conjunction with the existing insn condition checks does seem to
fix this problem.  I'm currently upstreaming the various bits to make that
happen.


More information about the Gcc-bugs mailing list