public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern
@ 2021-10-26 6:39 marxin at gcc dot gnu.org
2021-10-26 6:40 ` [Bug target/102941] " marxin at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-26 6:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Bug ID: 102941
Summary: ICE in extract_insn, at recog.c:2769 with
-ftrivial-auto-var-init=pattern
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: qing.zhao at oracle dot com
Target Milestone: ---
Host: x86_64-linux-gnu
Target: aarch64-linux-gnu
The following happens:
$ cat asm-flag.c
int test_cmpu_x;
void
test_cmpu_y() {
long le;
__asm__("cmp %"
"[x], %"
"[y]"
: "=@ccls"(le)
: [x] ""(test_cmpu_x), [y] ""(test_cmpu_y));
}
$ aarch64-linux-gnu-gcc asm-flag.c -c
$ aarch64-linux-gnu-gcc asm-flag.c -c -ftrivial-auto-var-init=pattern
asm-flag.c: In function ‘test_cmpu_y’:
asm-flag.c:11:1: error: unrecognizable insn:
11 | }
| ^
(insn 13 14 0 2 (set (mem/c:DI (plus:DI (reg/f:DI 87 virtual-stack-vars)
(const_int -8 [0xfffffffffffffff8])) [2 le+0 S8 A64])
(leu:DI (reg:CC 66 cc)
(const_int 0 [0]))) "asm-flag.c":6:3 -1
(nil))
during RTL pass: vregs
asm-flag.c:11:1: internal compiler error: in extract_insn, at recog.c:2769
0x6a7b6b _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/rtl-error.c:108
0x6a7b87 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/rtl-error.c:116
0x6a6fa4 extract_insn(rtx_insn*)
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/recog.c:2769
0x945a6d instantiate_virtual_regs_in_insn
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/function.c:1611
0x945a6d instantiate_virtual_regs
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/function.c:1985
0x945a6d execute
/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-aarch64/build/gcc/function.c:2034
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
@ 2021-10-26 6:40 ` marxin at gcc dot gnu.org
2021-10-26 6:42 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-26 6:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-10-26
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
2021-10-26 6:40 ` [Bug target/102941] " marxin at gcc dot gnu.org
@ 2021-10-26 6:42 ` pinskia at gcc dot gnu.org
2021-10-26 6:49 ` [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken pinskia at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 6:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |---
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
2021-10-26 6:40 ` [Bug target/102941] " marxin at gcc dot gnu.org
2021-10-26 6:42 ` pinskia at gcc dot gnu.org
@ 2021-10-26 6:49 ` pinskia at gcc dot gnu.org
2021-10-26 6:54 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 6:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE in extract_insn, at |ICE in extract_insn with
|recog.c:2769 with |ccflags output from
|-ftrivial-auto-var-init=pat |inline-asm and var with
|tern |address taken
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplified testcase without -ftrivial-auto-var-init=pattern
int test_cmpu_x;
void f(long *);
void
test_cmpu_y() {
long le;
f(&le);
__asm__("cmp %"
"[x], %"
"[y]"
: "=@ccls"(le)
: [x] ""(test_cmpu_x), [y] ""(test_cmpu_y));
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (2 preceding siblings ...)
2021-10-26 6:49 ` [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken pinskia at gcc dot gnu.org
@ 2021-10-26 6:54 ` pinskia at gcc dot gnu.org
2021-10-26 7:08 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 6:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a testcase which fails at all optimization levels (not DCEing out
stuff):
int test_cmpu_x;
long
test_cmpu_y() {
long le;
f(&le);
__asm__("cmp %"
"[x], %"
"[y]"
: "=@ccls"(le)
: [x] ""(test_cmpu_x), [y] ""(test_cmpu_y));
return le;
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (3 preceding siblings ...)
2021-10-26 6:54 ` pinskia at gcc dot gnu.org
@ 2021-10-26 7:08 ` pinskia at gcc dot gnu.org
2021-10-26 7:12 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 7:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think I have a fix.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (4 preceding siblings ...)
2021-10-26 7:08 ` pinskia at gcc dot gnu.org
@ 2021-10-26 7:12 ` pinskia at gcc dot gnu.org
2021-10-26 7:32 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 7:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Host|x86_64-linux-gnu |
Target|aarch64-linux-gnu |aarch64-*-* arm*-*-*
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The fix:
diff --git a/gcc/config/arm/aarch-common.c b/gcc/config/arm/aarch-common.c
index 67343fe4025..60b3516c1df 100644
--- a/gcc/config/arm/aarch-common.c
+++ b/gcc/config/arm/aarch-common.c
@@ -641,7 +641,7 @@ arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &
/*inputs*/,
rtx x = gen_rtx_REG (mode, CC_REGNUM);
x = gen_rtx_fmt_ee (code, word_mode, x, const0_rtx);
- if (dest_mode == word_mode)
+ if (dest_mode == word_mode && REG_P (dest))
emit_insn (gen_rtx_SET (dest, x));
else
{
This means you could also run into this on arm-linux-gnueabi too.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (5 preceding siblings ...)
2021-10-26 7:12 ` pinskia at gcc dot gnu.org
@ 2021-10-26 7:32 ` pinskia at gcc dot gnu.org
2021-10-26 9:45 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 7:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 51665
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51665&action=edit
Patch which I am testing
This is the patch which I am testing which fixes the issue. I tested on the
testcase already too.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (6 preceding siblings ...)
2021-10-26 7:32 ` pinskia at gcc dot gnu.org
@ 2021-10-26 9:45 ` pinskia at gcc dot gnu.org
2021-10-26 14:42 ` qinzhao at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2021-October
| |/582590.html
Keywords| |patch
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582590.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (7 preceding siblings ...)
2021-10-26 9:45 ` pinskia at gcc dot gnu.org
@ 2021-10-26 14:42 ` qinzhao at gcc dot gnu.org
2021-10-26 14:50 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2021-10-26 14:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
qinzhao at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |qinzhao at gcc dot gnu.org
--- Comment #7 from qinzhao at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #1)
> Simplified testcase without -ftrivial-auto-var-init=pattern
>
> int test_cmpu_x;
> void f(long *);
>
> void
> test_cmpu_y() {
> long le;
> f(&le);
> __asm__("cmp %"
> "[x], %"
> "[y]"
> : "=@ccls"(le)
> : [x] ""(test_cmpu_x), [y] ""(test_cmpu_y));
> }
One question:
is this ICE triggered by the call to __builtin_clear_padding (&le,....)
inserted by -ftrivial-auto-var-init=pattern (which makes the "le" address
taken, therefore resulting the final ICE?)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (8 preceding siblings ...)
2021-10-26 14:42 ` qinzhao at gcc dot gnu.org
@ 2021-10-26 14:50 ` pinskia at gcc dot gnu.org
2022-01-07 22:07 ` cvs-commit at gcc dot gnu.org
2022-01-07 22:08 ` pinskia at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-26 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to qinzhao from comment #7)
> One question:
>
> is this ICE triggered by the call to __builtin_clear_padding (&le,....)
> inserted by -ftrivial-auto-var-init=pattern (which makes the "le" address
> taken, therefore resulting the final ICE?)
Yes.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (9 preceding siblings ...)
2021-10-26 14:50 ` pinskia at gcc dot gnu.org
@ 2022-01-07 22:07 ` cvs-commit at gcc dot gnu.org
2022-01-07 22:08 ` pinskia at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-07 22:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:997130f778c56466a825627644e510960585521b
commit r12-6374-g997130f778c56466a825627644e510960585521b
Author: Andrew Pinski <apinski@marvell.com>
Date: Tue Oct 26 07:28:09 2021 +0000
target: [PR102941] Fix inline-asm flags with non-REG_P output
So the problem here is that arm_md_asm_adjust would
just create a set directly to the output memory which is wrong.
It needs to output to a temp register first and then do a
move.
OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
I have no way to test on arm even though this touches common code.
PR target/102941
gcc/ChangeLog:
* config/arm/aarch-common.c (arm_md_asm_adjust):
Use a temp if !REG_P.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/asm-flag-7.c: New test.
* gcc.target/arm/asm-flag-7.c: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
` (10 preceding siblings ...)
2022-01-07 22:07 ` cvs-commit at gcc dot gnu.org
@ 2022-01-07 22:08 ` pinskia at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 22:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-01-07 22:08 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 6:39 [Bug target/102941] New: ICE in extract_insn, at recog.c:2769 with -ftrivial-auto-var-init=pattern marxin at gcc dot gnu.org
2021-10-26 6:40 ` [Bug target/102941] " marxin at gcc dot gnu.org
2021-10-26 6:42 ` pinskia at gcc dot gnu.org
2021-10-26 6:49 ` [Bug target/102941] ICE in extract_insn with ccflags output from inline-asm and var with address taken pinskia at gcc dot gnu.org
2021-10-26 6:54 ` pinskia at gcc dot gnu.org
2021-10-26 7:08 ` pinskia at gcc dot gnu.org
2021-10-26 7:12 ` pinskia at gcc dot gnu.org
2021-10-26 7:32 ` pinskia at gcc dot gnu.org
2021-10-26 9:45 ` pinskia at gcc dot gnu.org
2021-10-26 14:42 ` qinzhao at gcc dot gnu.org
2021-10-26 14:50 ` pinskia at gcc dot gnu.org
2022-01-07 22:07 ` cvs-commit at gcc dot gnu.org
2022-01-07 22:08 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).