[Bug target/96866] ICE in print_operand_address, at config/rs6000/rs6000.c:13560

2024-07-23 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96866

--- Comment #4 from GCC Commits  ---
The master branch has been updated by Jiu Fu Guo :

https://gcc.gnu.org/g:472eab9ab1fdfd0ba3a555ea9eb50e20307c7052

commit r15-2225-g472eab9ab1fdfd0ba3a555ea9eb50e20307c7052
Author: Jiufu Guo 
Date:   Tue Jul 23 13:34:20 2024 +0800

report message for operator %a on unaddressible operand

Hi,

For PR96866, when printing asm code for modifier "%a", an addressable
operand is required.  While the constraint "X" allow any kind of
operand even which is hard to get the address directly. e.g. extern
symbol whose address is in TOC.
An error message would be reported to indicate the invalid asm operand.

Compare with previous version, test case is updated with -mno-pcrel.

Bootstrap pass on ppc64{,le}.
Is this ok for trunk?

BR,
Jeff(Jiufu Guo)

PR target/96866

gcc/ChangeLog:

* config/rs6000/rs6000.cc (print_operand_address): Emit message for
unsupported operand.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr96866-1.c: New test.
* gcc.target/powerpc/pr96866-2.c: New test.

[Bug target/96866] ICE in print_operand_address, at config/rs6000/rs6000.c:13560

2024-04-25 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96866

--- Comment #3 from Jiu Fu Guo  ---

While, I'm wondering if we could accept this code, and handle it as something
like:

(insn 5 4 6 (set (reg/f:DI 118)
(mem/u/c:DI (unspec:DI [
(symbol_ref/u:DI ("*.LC0") [flags 0x2])
(reg:DI 2 2)
] UNSPEC_TOCREL) [2  S8 A8])) "t.c":8:8 -1
 (expr_list:REG_EQUAL (symbol_ref:DI ("x") [flags 0x80]  )
(nil)))

(insn 6 5 0 (parallel [
(asm_operands/v ("#%a0") ("") 0 [
(reg/f:DI 118)
]
 [
(asm_input:DI ("X") t.c:9)
]
 [] t.c:9)
(clobber (reg:SI 98 ca))
]) "t.c":9:3 -1
 (nil))

[Bug target/96866] ICE in print_operand_address, at config/rs6000/rs6000.c:13560

2024-04-25 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96866

Jiu Fu Guo  changed:

   What|Removed |Added

 CC||guojiufu at gcc dot gnu.org

--- Comment #2 from Jiu Fu Guo  ---
with -fPIC, the asm insn in RTL looks like:

(insn 8 7 0 (parallel [ 
(asm_operands/v ("#%a0") ("") 0 [   
(symbol_ref:DI ("x") [flags 0x80]  )
]   
 [  
(asm_input:DI ("X") t.c:9)  
]   
 [] t.c:9)  
(clobber (reg:SI 98 ca))
]) "t.c":9:3 -1 
 (nil))


Here operand 0 of asm is "(symbol_ref:DI ("x")..)", this is not handled as the
invalid address.
Some targets(e.g. x86_64) report messages (like "invalid constraints for
operand") for this code.

This PR mentions ice-on-invalid-code too :)

[Bug target/96866] ICE in print_operand_address, at config/rs6000/rs6000.c:13560

2024-03-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96866

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Target|powerpc-*-linux-gnu |powerpc*-*-linux-gnu
   Last reconfirmed||2024-03-23
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
Confirmed.

Testcase just in case the source file disappears from the testsuite:
```
void f (void) { extern int x; asm volatile ("#%a0" :: "X" ()); }

```