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

--- Comment #6 from Jose Silva <krystalgamer at protonmail dot com> ---
Yes, noipa does help.

(In reply to Andrew Pinski from comment #3)
> Oh that is because there is some IPA Register allocation going on. Anyways
> this is still not a bug. You need to mark a0 as a clobber in the inline-asm
> to let GCC know that a0 is touched.

As I said I simplified the example, the original code had a syscall which I
have no idea which registers will be clobbered.


Before upgrading compilers I was using GCC 3.2 which produces the following
code with `-nostdlib -Os`:

```
a0020060 <test>:
a0020060:       27bdfff0        addiu   sp,sp,-16
a0020064:       ffb00000        sd      s0,0(sp)
a0020068:       ffbf0008        sd      ra,8(sp)
a002006c:       0c008016        jal     a0020058 <fail>
a0020070:       0080802d        move    s0,a0
a0020074:       0200202d        move    a0,s0
a0020078:       dfbf0008        ld      ra,8(sp)
a002007c:       dfb00000        ld      s0,0(sp)
a0020080:       08008012        j       a0020048 <is_first_char_a>
a0020084:       27bd0010        addiu   sp,sp,16
```


I'm quite confused on why you say "Anyways this is still not a bug". IPA RA is
making assumptions on procedures where it does not have enough information to
do so, i.e functions with asm statements. It is disabled when a function
pointer is used, why shouldn't it be for when a function with ASM statement is
encountered?


The code inside the `fail()` function is valid and does not break the ABI, GCC
does not have enough information to perform IPA RA but does so(wrongly), to me
that's a bug.

Reply via email to