diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-10-24 18:03:17 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-10-24 18:03:17 -0400 |
commit | d80a26cca025877b7657fa355570bc301223b50b (patch) | |
tree | 56306d3e0dd6a08f6175269cbbc3cb140f016f7c /libgcc | |
parent | 51f164f76212feaf896d65616f60877d3217b701 (diff) | |
download | gcc-d80a26cca025877b7657fa355570bc301223b50b.zip gcc-d80a26cca025877b7657fa355570bc301223b50b.tar.gz gcc-d80a26cca025877b7657fa355570bc301223b50b.tar.bz2 |
c++: non-dep array new-expr size [PR111929]
This PR is another instance of NON_DEPENDENT_EXPR having acted as an
"analysis barrier" for middle-end routines, and now that it's gone we're
more prone to passing weird templated trees (that have a generic tree
code) to middle-end routines which end up ICEing on such trees.
In the testcase below the non-dependent array new-expr size 'x + 42' is
expressed as an ordinary PLUS_EXPR, but whose operands have different
types (since templated trees encode just the syntactic form of an
expression devoid of e.g. implicit conversions). This type incoherency
triggers an ICE from size_binop in build_new_1 due to a wide_int assert
that expects the operand types to have the same precision.
This patch fixes this by replacing our piecemeal folding of 'size' in
build_new_1 with a single call to cp_fully_fold (which is a no-op in a
template context) once 'size' is built up.
PR c++/111929
gcc/cp/ChangeLog:
* init.cc (build_new_1): Use convert, build2, build3 and
cp_fully_fold instead of fold_convert, size_binop and
fold_build3 when building up 'size'.
gcc/testsuite/ChangeLog:
* g++.dg/template/non-dependent28.C: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions