public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
@ 2021-07-20 15:38 zsojka at seznam dot cz
2021-07-20 16:24 ` [Bug middle-end/101530] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2021-07-20 15:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
Bug ID: 101530
Summary: ICE: 'verify_gimple' failed: non-top-level
'bit_field_ref' with __builtin_shufflevector()[0]
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Created attachment 51178
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51178&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c
testcase.c: In function 'foo':
testcase.c:4:1: error: non-top-level 'bit_field_ref'
4 | foo(V v, int i)
| ^~~
_2 = VIEW_CONVERT_EXPR<int>(BIT_FIELD_REF <_1, 32, 0>);
testcase.c:4:1: internal compiler error: 'verify_gimple' failed
0x10e0a2d verify_gimple_in_seq(gimple*)
/repo/gcc-trunk/gcc/tree-cfg.c:5188
0xdd0b46 gimplify_body(tree_node*, bool)
/repo/gcc-trunk/gcc/gimplify.c:15526
0xdd0ccd gimplify_function_tree(tree_node*)
/repo/gcc-trunk/gcc/gimplify.c:15597
0xbfa847 cgraph_node::analyze()
/repo/gcc-trunk/gcc/cgraphunit.c:670
0xbfd327 analyze_functions
/repo/gcc-trunk/gcc/cgraphunit.c:1234
0xbfdfcd symbol_table::finalize_compilation_unit()
/repo/gcc-trunk/gcc/cgraphunit.c:2508
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.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-2398-20210719103439-gf007a638a86-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-2398-20210719103439-gf007a638a86-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210719 (experimental) (GCC)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
@ 2021-07-20 16:24 ` jakub at gcc dot gnu.org
2021-07-21 6:51 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-20 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Bet if BIT_FIELD_REF in the middle aren't allowed gimplify_compound_lval could
at least for the non-lvalue case stop walk on BIT_FIELD_REF that isn't the
outermost. But I have no idea what to do if it is lvalue, i.e. if we want e.g.
VIEW_CONVERT_EXPR <type, BIT_FIELD_REF <var, x, y>> on the lhs.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
2021-07-20 16:24 ` [Bug middle-end/101530] " jakub at gcc dot gnu.org
@ 2021-07-21 6:51 ` rguenth at gcc dot gnu.org
2022-01-05 14:09 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-21 6:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-07-21
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I don't think we need V_C_E <BIT_FIELD_REF <>> on the LHS, V_C_E is not
size-changing so you can do
BIT_FIELD_REF <> = V_C_E <>
instead, thus move the V_C_E to the RHS. We're restricting BIT_FIELD_REFs
to produce is_gimple_reg_type so for the case in question we're expecting
D.1234 = BIT_FIELD_REF <_1, 32, 0>;
_2 = VIEW_CONVERT_EXPR<int> (D.1234);
of course we could have folded the BIT_FIELD_REF which produces a V1SI to
produce a SI, consuming the VIEW_CONVERT_EXPR.
I guess we need similar handling for compound_lval components as we have
for toplevel VIEW_CONVERT_EXPR:
case VIEW_CONVERT_EXPR:
if ((fallback & fb_rvalue)
&& is_gimple_reg_type (TREE_TYPE (*expr_p))
&& is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
{
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
post_p, is_gimple_val, fb_rvalue);
recalculate_side_effects (*expr_p);
break;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
2021-07-20 16:24 ` [Bug middle-end/101530] " jakub at gcc dot gnu.org
2021-07-21 6:51 ` rguenth at gcc dot gnu.org
@ 2022-01-05 14:09 ` rguenth at gcc dot gnu.org
2022-01-10 11:21 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-05 14:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
If we stop walking in gimplify_compound_lval we still gimplify the tail in the
same way, not assigning the register typed BIT_FIELD_REF to a temporary.
A bit less degenerate testcase:
typedef int __attribute__((__vector_size__ (16))) V;
int
foo(V v, int i)
{
return __builtin_shufflevector (v, v, 2, 3)[i];
}
We can't really simplify the original GENERIC much here:
return VIEW_CONVERT_EXPR<int[2]>(BIT_FIELD_REF < VEC_PERM_EXPR < v , v , { 2,
3, 2, 3 } > , 64, 0>)[i];
the BIT_FIELD_REF is used to subset the vector, what we'd need to somehow
ensure is to force that to an rvalue. I suppose that would be possible
if we'd wrap it in a TARGET_EXPR somehow. At least the following works for me:
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 13341fa315e..4631d50c6f0 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1243,6 +1243,8 @@ c_build_shufflevector (location_t loc, tree v0, tree v1,
tree lpartt = build_vector_type (TREE_TYPE (ret_type), mask.length ());
ret = build3_loc (loc, BIT_FIELD_REF,
lpartt, ret, TYPE_SIZE (lpartt), bitsize_zero_node);
+ tree tem = create_tmp_var_raw (lpartt);
+ ret = build4 (TARGET_EXPR, lpartt, tem, ret, NULL_TREE, NULL_TREE);
}
if (!c_dialect_cxx () && !wrap)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
` (2 preceding siblings ...)
2022-01-05 14:09 ` rguenth at gcc dot gnu.org
@ 2022-01-10 11:21 ` cvs-commit at gcc dot gnu.org
2022-01-10 11:22 ` rguenth at gcc dot gnu.org
2022-01-12 8:40 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-10 11:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:be59671c5624fe8bf21ddb0192e97ebdfa4db381
commit r12-6403-gbe59671c5624fe8bf21ddb0192e97ebdfa4db381
Author: Richard Biener <rguenther@suse.de>
Date: Wed Jan 5 15:13:33 2022 +0100
middle-end/101530 - fix shufflevector lowering
This makes __builtin_shufflevector lowering force the result
of the BIT_FIELD_REF lowpart operation to a temporary as to
fulfil the IL verifier constraint that BIT_FIELD_REFs should
be always in outermost handled component position. Trying to
enforce this during gimplification isn't as straight-forward
as here where we know we're dealing with an rvalue.
FAIL: c-c++-common/torture/builtin-shufflevector-1.c -O0 execution test
2022-01-05 Richard Biener <rguenther@suse.de>
PR middle-end/101530
gcc/c-family/
* c-common.c (c_build_shufflevector): Wrap the BIT_FIELD_REF
in a TARGET_EXPR to force a temporary.
gcc/testsuite/
* c-c++-common/builtin-shufflevector-3.c: New testcase.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
` (3 preceding siblings ...)
2022-01-10 11:21 ` cvs-commit at gcc dot gnu.org
@ 2022-01-10 11:22 ` rguenth at gcc dot gnu.org
2022-01-12 8:40 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-10 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/101530] ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0]
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
` (4 preceding siblings ...)
2022-01-10 11:22 ` rguenth at gcc dot gnu.org
@ 2022-01-12 8:40 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-12 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101530
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:2c4dccb605d485293291878397b42927dc050481
commit r12-6514-g2c4dccb605d485293291878397b42927dc050481
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 12 09:39:21 2022 +0100
testsuite: Fix up c-c++-common/builtin-shufflevector-3.c testcase
[PR101530]
This fixes:
FAIL: c-c++-common/builtin-shufflevector-3.c -Wc++-compat (test for
excess errors)
Excess errors:
.../gcc/testsuite/c-c++-common/builtin-shufflevector-3.c:6:1: warning: SSE
vector argument without SSE enabled changes the ABI [-Wpsabi]
2022-01-12 Jakub Jelinek <jakub@redhat.com>
PR middle-end/101530
* c-c++-common/builtin-shufflevector-3.c: Add -Wno-psabi to
dg-options.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-12 8:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 15:38 [Bug middle-end/101530] New: ICE: 'verify_gimple' failed: non-top-level 'bit_field_ref' with __builtin_shufflevector()[0] zsojka at seznam dot cz
2021-07-20 16:24 ` [Bug middle-end/101530] " jakub at gcc dot gnu.org
2021-07-21 6:51 ` rguenth at gcc dot gnu.org
2022-01-05 14:09 ` rguenth at gcc dot gnu.org
2022-01-10 11:21 ` cvs-commit at gcc dot gnu.org
2022-01-10 11:22 ` rguenth at gcc dot gnu.org
2022-01-12 8:40 ` cvs-commit 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).