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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|powerpc64-linux             |powerpc64-linux,
                   |                            |aarch64-linux-gnu
          Component|middle-end                  |rtl-optimization

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
loop2_invariant moves the instruction.
You can also reproduce the failure on aarch64 with the following:
```
struct task_struct;
struct task_struct *get_current();
struct task_struct {
  int __state;
};
void f() {
  asm goto("# %0" : : : : __label_warn_on);
  __builtin_unreachable();
__label_warn_on:
  while (1)
    get_current()->__state = 1;
}
```
Which changes 0 for 1(on aarch64, zero can be used for a store which is why it
works for 0).
It works on x86_64 because the move accepts the 1.

Note on the trunk, the ICE is the following:
<source>: In function 'void f()':
<source>:12:1: error: in basic block 2:
   12 | }
      | ^
<source>:12:1: error: flow control insn inside a basic block
(jump_insn 5 2 12 2 (asm_operands/v ("# %0") ("") 0 []
         []
         [
            (label_ref:DI 8)
        ] <source>:7) "<source>":7:3 -1
     (nil)
 -> 8)
during RTL pass: loop2_invariant
dump file: /app/output.cpp.272r.loop2_invariant
<source>:12:1: internal compiler error: in rtl_verify_bb_insns, at
cfgrtl.cc:2797
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to