public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
@ 2022-06-07 10:16 zsojka at seznam dot cz
2022-06-07 10:21 ` [Bug c++/105871] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2022-06-07 10:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
Bug ID: 105871
Summary: ICE: in wide_int_to_tree_1, at tree.cc:1777 with
__builtin_shufflevector() in C++ code
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Created attachment 53098
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53098&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.C
testcase.C: In function 'void foo()':
testcase.C:7:47: internal compiler error: in wide_int_to_tree_1, at
tree.cc:1777
7 | __builtin_shufflevector ((U){}, (V){}, 0) / 1;
| ^
0x8f4c57 wide_int_to_tree_1
/repo/gcc-trunk/gcc/tree.cc:1777
0x198473f wide_int_to_tree(tree_node*, poly_int<1u,
generic_wide_int<wide_int_ref_storage<false, true> > > const&)
/repo/gcc-trunk/gcc/tree.cc:1889
0x198473f build_int_cst(tree_node*, poly_int<1u, long>)
/repo/gcc-trunk/gcc/tree.cc:1529
0xe5be5d cxx_eval_bit_field_ref
/repo/gcc-trunk/gcc/cp/constexpr.cc:4211
0xe4d50e cxx_eval_constant_expression
/repo/gcc-trunk/gcc/cp/constexpr.cc:7177
0xe51576 cxx_eval_outermost_constant_expr
/repo/gcc-trunk/gcc/cp/constexpr.cc:7863
0xe5607d maybe_constant_value(tree_node*, tree_node*, bool)
/repo/gcc-trunk/gcc/cp/constexpr.cc:8141
0xe846b4 cp_fully_fold(tree_node*)
/repo/gcc-trunk/gcc/cp/cp-gimplify.cc:2353
0xe846b4 cp_fully_fold(tree_node*)
/repo/gcc-trunk/gcc/cp/cp-gimplify.cc:2345
0x108364a cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
/repo/gcc-trunk/gcc/cp/typeck.cc:6273
0xe1f988 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
/repo/gcc-trunk/gcc/cp/call.cc:6935
0x1075abe build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
/repo/gcc-trunk/gcc/cp/typeck.cc:4565
0xf7fa5b cp_parser_binary_expression
/repo/gcc-trunk/gcc/cp/parser.cc:10209
0xf801dc cp_parser_assignment_expression
/repo/gcc-trunk/gcc/cp/parser.cc:10347
0xf81cb2 cp_parser_expression
/repo/gcc-trunk/gcc/cp/parser.cc:10517
0xf852a8 cp_parser_expression_statement
/repo/gcc-trunk/gcc/cp/parser.cc:12734
0xf922ff cp_parser_statement
/repo/gcc-trunk/gcc/cp/parser.cc:12526
0xf9347d cp_parser_statement_seq_opt
/repo/gcc-trunk/gcc/cp/parser.cc:12883
0xf93558 cp_parser_compound_statement
/repo/gcc-trunk/gcc/cp/parser.cc:12835
0xfb3a95 cp_parser_function_body
/repo/gcc-trunk/gcc/cp/parser.cc:25184
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
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-r13-1003-20220607102453-gcef3f69c2f4-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.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
--disable-bootstrap --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-r13-1003-20220607102453-gcef3f69c2f4-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220607 (experimental) (GCC)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
@ 2022-06-07 10:21 ` jakub at gcc dot gnu.org
2022-06-07 10:51 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-07 10:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
ICEs since r12-1128-gef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3 when
__builtin_shufflevector support has been added.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
2022-06-07 10:21 ` [Bug c++/105871] " jakub at gcc dot gnu.org
@ 2022-06-07 10:51 ` jakub at gcc dot gnu.org
2022-06-07 12:20 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-07 10:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-06-07
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is in the C++ FE constexpr evaluation of it.
Will handle it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
2022-06-07 10:21 ` [Bug c++/105871] " jakub at gcc dot gnu.org
2022-06-07 10:51 ` jakub at gcc dot gnu.org
@ 2022-06-07 12:20 ` jakub at gcc dot gnu.org
2022-06-09 15:58 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-07 12:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 53099
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53099&action=edit
gcc13-pr105871.patch
Untested fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
` (2 preceding siblings ...)
2022-06-07 12:20 ` jakub at gcc dot gnu.org
@ 2022-06-09 15:58 ` cvs-commit at gcc dot gnu.org
2022-06-19 10:08 ` cvs-commit at gcc dot gnu.org
2022-06-20 9:58 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-09 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
--- Comment #4 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:4c334e0e4ff05d3a7ca9ebb832428c446cd0ae8d
commit r13-1027-g4c334e0e4ff05d3a7ca9ebb832428c446cd0ae8d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jun 9 17:42:31 2022 +0200
c++: Fix up ICE on __builtin_shufflevector constexpr evaluation [PR105871]
As the following testcase shows, BIT_FIELD_REF result doesn't have to have
just integral type, it can also have vector type. And in that case
cxx_eval_bit_field_ref just ICEs on it because it is unprepared for that
case, creates the initial value with build_int_cst (sure, that one could be
easily replaced with build_zero_cst) and then expects it can through
shifts,
ands and ors come up with the final value, but that doesn't work for
vectors.
We already call fold_ternary if whole is a VECTOR_CST, this patch does the
same if the result doesn't have integral type. And, there is no guarantee
fold_ternary will succeed and the callers certainly don't expect NULL
being returned, so it also diagnoses those as non-constant and returns
original t in that case.
2022-06-09 Jakub Jelinek <jakub@redhat.com>
PR c++/105871
* constexpr.cc (cxx_eval_bit_field_ref): For BIT_FIELD_REF with
non-integral result type use fold_ternary too like for
BIT_FIELD_REFs
from VECTOR_CST. If fold_ternary returns NULL, diagnose
non-constant
expression, set *non_constant_p and return t, instead of returning
NULL.
* g++.dg/pr105871.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
` (3 preceding siblings ...)
2022-06-09 15:58 ` cvs-commit at gcc dot gnu.org
@ 2022-06-19 10:08 ` cvs-commit at gcc dot gnu.org
2022-06-20 9:58 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-19 10:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:0ddeeb11e45b9b7e9ebc18292a42769304bf3e44
commit r12-8492-g0ddeeb11e45b9b7e9ebc18292a42769304bf3e44
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Jun 9 17:42:31 2022 +0200
c++: Fix up ICE on __builtin_shufflevector constexpr evaluation [PR105871]
As the following testcase shows, BIT_FIELD_REF result doesn't have to have
just integral type, it can also have vector type. And in that case
cxx_eval_bit_field_ref just ICEs on it because it is unprepared for that
case, creates the initial value with build_int_cst (sure, that one could be
easily replaced with build_zero_cst) and then expects it can through
shifts,
ands and ors come up with the final value, but that doesn't work for
vectors.
We already call fold_ternary if whole is a VECTOR_CST, this patch does the
same if the result doesn't have integral type. And, there is no guarantee
fold_ternary will succeed and the callers certainly don't expect NULL
being returned, so it also diagnoses those as non-constant and returns
original t in that case.
2022-06-09 Jakub Jelinek <jakub@redhat.com>
PR c++/105871
* constexpr.cc (cxx_eval_bit_field_ref): For BIT_FIELD_REF with
non-integral result type use fold_ternary too like for
BIT_FIELD_REFs
from VECTOR_CST. If fold_ternary returns NULL, diagnose
non-constant
expression, set *non_constant_p and return t, instead of returning
NULL.
* g++.dg/pr105871.C: New test.
(cherry picked from commit 4c334e0e4ff05d3a7ca9ebb832428c446cd0ae8d)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105871] ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
` (4 preceding siblings ...)
2022-06-19 10:08 ` cvs-commit at gcc dot gnu.org
@ 2022-06-20 9:58 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-20 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105871
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 12.2 and 13+.
GCC 11 doesn't have __builtin_shufflevector support.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-06-20 9:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 10:16 [Bug c++/105871] New: ICE: in wide_int_to_tree_1, at tree.cc:1777 with __builtin_shufflevector() in C++ code zsojka at seznam dot cz
2022-06-07 10:21 ` [Bug c++/105871] " jakub at gcc dot gnu.org
2022-06-07 10:51 ` jakub at gcc dot gnu.org
2022-06-07 12:20 ` jakub at gcc dot gnu.org
2022-06-09 15:58 ` cvs-commit at gcc dot gnu.org
2022-06-19 10:08 ` cvs-commit at gcc dot gnu.org
2022-06-20 9:58 ` jakub 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).