* [Bug target/105856] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
@ 2022-06-05 13:15 ` dcb314 at hotmail dot com
2022-06-05 21:31 ` [Bug target/105856] [13 Regression] " roger at nextmovesoftware dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2022-06-05 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
The bug first appears sometime after git hash de57440858591a88.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
2022-06-05 13:15 ` [Bug target/105856] " dcb314 at hotmail dot com
@ 2022-06-05 21:31 ` roger at nextmovesoftware dot com
2022-06-06 13:52 ` roger at nextmovesoftware dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-06-05 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ice in emit_move_insn, at |[13 Regression] ice in
|expr.cc:4011 |emit_move_insn, at
| |expr.cc:4011
Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com
CC| |roger at nextmovesoftware dot com
Priority|P3 |P1
Version|12.0 |13.0
Status|UNCONFIRMED |ASSIGNED
Keywords| |ice-on-valid-code
Target Milestone|--- |13.0
Last reconfirmed| |2022-06-05
Target| |arm*
Ever confirmed|0 |1
--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
Mine. Sorry for the breakage. I've a fix that avoids the ICE on ARM, and
allows GCC to generate the following code for this testcase:
g_329_3:
mov r0, #6
b func_19
[i.e. the same code as without the #pragma pack(1)].
This is a big improvement on GCC v12 which generates
(both with and without #pragma pack(1)):
g_329_3:
movw r3, #:lower16:.LANCHOR0
movt r3, #:upper16:.LANCHOR0
ldr r0, [r3]
b func_19
I'm bootstrapping and regression testing on x86_64 now.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
2022-06-05 13:15 ` [Bug target/105856] " dcb314 at hotmail dot com
2022-06-05 21:31 ` [Bug target/105856] [13 Regression] " roger at nextmovesoftware dot com
@ 2022-06-06 13:52 ` roger at nextmovesoftware dot com
2022-06-06 17:02 ` dcb314 at hotmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-06-06 13:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
Patch proposed:
https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596242.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
` (2 preceding siblings ...)
2022-06-06 13:52 ` roger at nextmovesoftware dot com
@ 2022-06-06 17:02 ` dcb314 at hotmail dot com
2022-06-07 9:13 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2022-06-06 17:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
Roger makes an interesting comment about test case coverage in the C and C++
testsuite.
There are about 45,000 C test cases and about 19,000 C++ test cases.
This gives pretty good coverage in practice, with only occasional problems
failing to be found.
The much stronger test of compiling an entire Linux distribution on x86_64,
which I do most weeks, generates about 340,000 object modules, so it is a far
bigger
and more comprehensive testcase.
It would be an obvious extension to compile a Linux distribution on
a different architecture. Maybe ARM or PowerPC or another primary gcc target ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
` (3 preceding siblings ...)
2022-06-06 17:02 ` dcb314 at hotmail dot com
@ 2022-06-07 9:13 ` cvs-commit at gcc dot gnu.org
2022-06-09 11:15 ` roger at nextmovesoftware dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-07 9:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:c00e1e3aa5ae62a991d105d309061d12f6a8764f
commit r13-1004-gc00e1e3aa5ae62a991d105d309061d12f6a8764f
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Jun 7 10:09:49 2022 +0100
PR middle-end/105853: Call store_constructor directly from calls.cc.
This patch fixes both ICE regressions PR middle-end/105853 and
PR target/105856 caused by my recent patch to expand small const structs
as immediate constants. That patch updated code generation in three
places: two in expr.cc that call store_constructor directly, and the
third in calls.cc's load_register_parameters that expands its CONSTRUCTOR
via expand_expr, as store_constructor is local/static to expr.cc, and
the "public" API, should usually simply forward the constructor to the
appropriate store_constructor function.
Alas, despite the clean regression testing on multiple targets, the above
ICEs show that expand_expr isn't a suitable proxy for store_constructor,
and things that (I'd assumed) shouldn't affect how/whether a struct is
placed in a register [such as whether the struct is considered packed/
aligned or not] actually interfere with the optimization that is being
attempted.
The (proposed) solution is to export store_constructor (and it's helper
function int_expr_size) from expr.cc, by removing their static qualifier
and prototyping both functions in expr.h, so they can be called directly
from load_register_parameters in calls.cc. This cures both ICEs, but
almost as importantly improves code generation over GCC 12.
For PR 105853, GCC 12 generates:
compose_nd_na_ipv6_src:
movzx eax, WORD PTR eth_addr_zero[rip+2]
movzx edx, WORD PTR eth_addr_zero[rip]
movzx edi, WORD PTR eth_addr_zero[rip+4]
sal rax, 16
or rax, rdx
sal rdi, 32
or rdi, rax
xor eax, eax
jmp packet_set_nd
eth_addr_zero: .zero 6
where now (with this fix) GCC 13 generates:
compose_nd_na_ipv6_src:
xorl %edi, %edi
xorl %eax, %eax
jmp packet_set_nd
Likewise, for PR 105856 on ARM, we'd previously generate:
g_329_3:
movw r3, #:lower16:.LANCHOR0
movt r3, #:upper16:.LANCHOR0
ldr r0, [r3]
b func_19
but with this optimization we now generate:
g_329_3:
mov r0, #6
b func_19
2022-06-07 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR middle-end/105853
PR target/105856
* calls.cc (load_register_parameters): Call store_constructor
and int_expr_size directly instead of expanding via expand_expr.
* expr.cc (static void store_constructor): Don't prototype here.
(static HOST_WIDE_INT int_expr_size): Likewise.
(store_constructor): No longer static.
(int_expr_size): Likewise, no longer static.
* expr.h (store_constructor): Prototype here.
(int_expr_size): Prototype here.
gcc/testsuite/ChangeLog
PR middle-end/105853
PR target/105856
* gcc.dg/pr105853.c: New test case.
* gcc.dg/pr105856.c: New test case.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
` (4 preceding siblings ...)
2022-06-07 9:13 ` cvs-commit at gcc dot gnu.org
@ 2022-06-09 11:15 ` roger at nextmovesoftware dot com
2022-06-09 11:50 ` dcb314 at hotmail dot com
2022-06-09 13:37 ` roger at nextmovesoftware dot com
7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-06-09 11:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #6 from Roger Sayle <roger at nextmovesoftware dot com> ---
Hi David. Thanks again for all your help (building Linux distributions is a
helpful/vital service to the GCC community). Can you confirm that this problem
is now fixed on ARM?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
` (5 preceding siblings ...)
2022-06-09 11:15 ` roger at nextmovesoftware dot com
@ 2022-06-09 11:50 ` dcb314 at hotmail dot com
2022-06-09 13:37 ` roger at nextmovesoftware dot com
7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2022-06-09 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Roger Sayle from comment #6)
> Hi David. Thanks again for all your help (building Linux distributions is a
> helpful/vital service to the GCC community).
Thanks. Good to know I am doing something useful.
820 bugs in 10+ years.
>Can you confirm that this problem is now fixed on ARM?
I just confirmed that today's gcc compiler (git hash 2fc6e3d55f6080da)
has it fixed.
Much thanks for your fast work on this bug report.
Found & fixed in four days.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/105856] [13 Regression] ice in emit_move_insn, at expr.cc:4011
2022-06-05 13:10 [Bug target/105856] New: ice in emit_move_insn, at expr.cc:4011 dcb314 at hotmail dot com
` (6 preceding siblings ...)
2022-06-09 11:50 ` dcb314 at hotmail dot com
@ 2022-06-09 13:37 ` roger at nextmovesoftware dot com
7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-06-09 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105856
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #8 from Roger Sayle <roger at nextmovesoftware dot com> ---
Thanks David.
^ permalink raw reply [flat|nested] 9+ messages in thread