diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-01-17 17:51:25 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-01-17 17:51:25 +0000 |
commit | bb9869d5a3e3a0f3673742ede7ea9bc325adbb4a (patch) | |
tree | 4ad7e64ad7b745b5bef09ce376f20f5235b2d803 /gcc/c/c-fold.c | |
parent | d2edcd7083601bc08789787331399624b85b843b (diff) | |
download | gcc-bb9869d5a3e3a0f3673742ede7ea9bc325adbb4a.zip gcc-bb9869d5a3e3a0f3673742ede7ea9bc325adbb4a.tar.gz gcc-bb9869d5a3e3a0f3673742ede7ea9bc325adbb4a.tar.bz2 |
C++: Fix crash in warn_for_memset within templates (PR c++/83814)
gcc/c-family/ChangeLog:
PR c++/83814
* c-common.c (fold_for_warn): Move to c/c-fold.c and cp/expr.c.
gcc/c/ChangeLog:
PR c++/83814
* c-fold.c (fold_for_warn): Move from c-common.c, reducing to just
the C part.
gcc/cp/ChangeLog:
PR c++/83814
* expr.c (fold_for_warn): Move from c-common.c, reducing to just
the C++ part. If processing a template, call
fold_non_dependent_expr rather than fully folding.
gcc/testsuite/ChangeLog:
PR c++/83814
PR c++/83902
* g++.dg/wrappers/pr83814.C: New test case.
* g++.dg/wrappers/pr83902.C: New test case.
From-SVN: r256804
Diffstat (limited to 'gcc/c/c-fold.c')
-rw-r--r-- | gcc/c/c-fold.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c index 12460bc..480e34c 100644 --- a/gcc/c/c-fold.c +++ b/gcc/c/c-fold.c @@ -676,3 +676,13 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, } return ret; } + +/* Fold X for consideration by one of the warning functions when checking + whether an expression has a constant value. */ + +tree +fold_for_warn (tree x) +{ + /* The C front-end has already folded X appropriately. */ + return x; +} |