aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-01-26 19:40:29 +0100
committerJakub Jelinek <jakub@redhat.com>2022-01-26 19:40:29 +0100
commitabea1c9a252ef7712ab800360e1e0e2697ee14f2 (patch)
treeeb1e8a153fc4d97f95b133c8bca5052d07ae0d42 /gcc/tree.h
parent7bd1e1296cc36b558a27bbe09352c5c2aca4c5d5 (diff)
downloadgcc-abea1c9a252ef7712ab800360e1e0e2697ee14f2.zip
gcc-abea1c9a252ef7712ab800360e1e0e2697ee14f2.tar.gz
gcc-abea1c9a252ef7712ab800360e1e0e2697ee14f2.tar.bz2
c++: Fix up handling of vector CONSTRUCTORs with vectors in it in constexpr.cc [PR104226]
The middle-end uses sometimes VECTOR_TYPE CONSTRUCTORs that contain some other VECTOR_TYPE elements in it (should be with compatible element size and smaller number of elements, e.g. a V8SImode vector can be constructed as { V4SImode_var_1, V4SImode_var_2 }), and expansion of __builtin_shufflevector emits these early, so constexpr.cc can see those too. constexpr.cc already has special cases for NULL index which is typical for VECTOR_TYPE CONSTRUCTORs, and for VECTOR_TYPE CONSTRUCTORs that contain just scalar elts that works just fine - init_subob_ctx just returns on non-aggregate elts and get_or_insert_ctor_field has if (TREE_CODE (type) == VECTOR_TYPE && index == NULL_TREE) { CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (ctor), index, NULL_TREE); return &CONSTRUCTOR_ELTS (ctor)->last(); } handling for it. But for the vector in vector case init_subob_ctx would try to create a sub-CONSTRUCTOR and even didn't handle the NULL index case well, so instead of creating the sub-CONSTRUCTOR after the elts already in it overwrote the first one. So (V8SImode) { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } } became (V8SImode) { 0, 0, 0, 0 } The following patch fixes it by not forcing a sub-CONSTRUCTOR for this vector in vector case. 2022-01-26 Jakub Jelinek <jakub@redhat.com> PR c++/104226 * constexpr.cc (init_subob_ctx): For vector ctors containing vector elements, ensure appending to the same ctor instead of creating another one. * g++.dg/cpp0x/constexpr-104226.C: New test.
Diffstat (limited to 'gcc/tree.h')
0 files changed, 0 insertions, 0 deletions