aboutsummaryrefslogtreecommitdiff
path: root/compile
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-10-21 18:04:54 +0200
committerJakub Jelinek <jakub@redhat.com>2022-10-21 18:04:54 +0200
commit2cc41601d9a948e8d612a21c3b9a44ce0b977747 (patch)
tree9ad44790376961af9de1d283b6edca8546cd5cc8 /compile
parentbf3b532b524ecacb3202ab2c8af419ffaaab7cff (diff)
downloadgcc-2cc41601d9a948e8d612a21c3b9a44ce0b977747.zip
gcc-2cc41601d9a948e8d612a21c3b9a44ce0b977747.tar.gz
gcc-2cc41601d9a948e8d612a21c3b9a44ce0b977747.tar.bz2
c++: Don't shortcut TREE_CONSTANT vector type CONSTRUCTORs in cxx_eval_constant_expression [PR107295]
The excess precision support broke building skia (dependency of firefox) on ia32 (it has something like the a constexpr variable), but as the other cases show, it is actually a preexisting problem if one uses casts from constants with wider floating point types. The problem is that cxx_eval_constant_expression tries to short-cut processing of TREE_CONSTANT CONSTRUCTORs if they satisfy reduced_constant_expression_p - instead of calling cxx_eval_bare_aggregate on them it just verifies flags and if they are TREE_CONSTANT even after that, just fold. Now, on the testcase we have a TREE_CONSTANT CONSTRUCTOR containing TREE_CONSTANT NOP_EXPR of REAL_CST. And, fold, which isn't recursive, doesn't optimize that into VECTOR_CST, while later on we are only able to optimize VECTOR_CST arithmetics, not arithmetics with vector CONSTRUCTORs. The following patch fixes that by rejecting CONSTRUCTORs with vector type in reduced_constant_expression_p regardless of whether they have CONSTRUCTOR_NO_CLEARING set or not, folding result in cxx_eval_bare_aggregate even if nothing has changed but it wasn't non-constant and removing folding from the TREE_CONSTANT reduced_constant_expression_p short-cut. 2022-10-21 Jakub Jelinek <jakub@redhat.com> PR c++/107295 * constexpr.cc (reduced_constant_expression_p) <case CONSTRUCTOR>: Return false for VECTOR_TYPE CONSTRUCTORs even without CONSTRUCTOR_NO_CLEARING set on them. (cxx_eval_bare_aggregate): If constant but !changed, fold before returning VECTOR_TYPE_P CONSTRUCTOR. (cxx_eval_constant_expression) <case CONSTRUCTOR>: Don't fold TREE_CONSTANT CONSTRUCTOR, just return it. * g++.dg/ext/vector42.C: New test.
Diffstat (limited to 'compile')
0 files changed, 0 insertions, 0 deletions