diff options
author | Marek Polacek <polacek@redhat.com> | 2023-12-05 15:23:52 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-12-14 16:05:37 -0500 |
commit | 8cccdc2176740f3e034ee6caa49552cf2f142744 (patch) | |
tree | 090045eb688fa26f2ffc7683c7be88b6982dd4ef /gcc/tree-vect-loop.cc | |
parent | 7b15959f8e35b821ebfe832a36e5e712b708dae1 (diff) | |
download | gcc-8cccdc2176740f3e034ee6caa49552cf2f142744.zip gcc-8cccdc2176740f3e034ee6caa49552cf2f142744.tar.gz gcc-8cccdc2176740f3e034ee6caa49552cf2f142744.tar.bz2 |
c++: fix ICE with sizeof in a template [PR112869]
This test shows that we cannot clear *walk_subtrees in
cp_fold_immediate_r when we're in_immediate_context, because that
checks even e.g. sk_template_parms, and, as the comment says, affects
cp_fold_r as well. Here we had an expression with
min ((long int) VIEW_CONVERT_EXPR<long unsigned int>(bytecount), (long int) <<< Unknown tree: sizeof_expr
(int) <<< error >>> >>>)
as its sub-expression, and we never evaluated that into
min ((long int) bytecount, 4)
so the SIZEOF_EXPR leaked into the middle end. We need to make sure
we are calling cp_fold on the SIZEOF_EXPR.
PR c++/112869
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold_immediate_r): Check cp_unevaluated_operand
and DECL_IMMEDIATE_FUNCTION_P rather than in_immediate_context.
gcc/testsuite/ChangeLog:
* g++.dg/template/sizeof18.C: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions