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

--- Comment #13 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Rich Felker from comment #12)
> > You can work around it on older GCC by simply not using a register var
> > for more than one asm operand, I think?
> 
> Nope. Making a syscall inherently requires binding specific registers for
> all of the inputs/outputs, unless you want to spill everything to an
> explicit structure in memory and load them all explicitly in the asm block.
> So it really is a big deal.

As Segher said, there were a lot of dependent patches that fixed latent bugs
that the previous patches had exposed.  My best guess of the patch that fixed
this specific problem (ie, LRA breaking the contract of using the user
defined/assigned register in inline asm) would be:

commit 2f0b80c7a4ab4254f57ba63de26ebb7896e3742d
Author:     Peter Bergner <berg...@linux.ibm.com>
AuthorDate: Thu Nov 8 22:39:45 2018 +0000
Commit:     Peter Bergner <berg...@gcc.gnu.org>
CommitDate: Thu Nov 8 16:39:45 2018 -0600

    re PR rtl-optimization/87600 (Fix for PRs 86939 and 87479 causes build
issues for several targets)

    gcc/
            PR rtl-optimization/87600
            * cfgexpand.c (expand_asm_stmt): Catch illegal asm constraint
usage.
            * lra-constraints.c (process_alt_operands): Skip illegal hard
            register usage.  Prefer reloading non hard register operands.

    gcc/testsuite/
            PR rtl-optimization/87600
            * gcc.dg/pr87600.h: New file.
            * gcc.dg/pr87600-1.c: New test.
            * gcc.dg/pr87600-2.c: Likewise.

    From-SVN: r265942


Specifically, the "Prefer reloading non hard register operands." part of the
patch.  Previous versions of GCC would sometimes silently spill user
defined/assigned hard registers used in inline asm, which is a no-no.

Reply via email to