diff options
author | Pádraig Brady <p@draigbrady.com> | 2018-09-05 09:59:08 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2018-09-05 09:59:08 +0000 |
commit | 86e95f35c522136ee6ec8b648b2fd415360774bc (patch) | |
tree | 6893b66a5908995889c2f03cabce24a941166eb6 /gcc/cp/lambda.c | |
parent | 888157af3ef730e1e66c5e84ade11036a09d2205 (diff) | |
download | gcc-86e95f35c522136ee6ec8b648b2fd415360774bc.zip gcc-86e95f35c522136ee6ec8b648b2fd415360774bc.tar.gz gcc-86e95f35c522136ee6ec8b648b2fd415360774bc.tar.bz2 |
[PR c++/87185] ICE in prune-lambdas
https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00249.html
cp/
PR c++/87185
* lambda.c (prune_lambda_captures): Protect against const_vars.get
returning NULL.
testsuite/
PR c++/87185
* g++.dg/pr87185.C: New.
From-SVN: r264118
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r-- | gcc/cp/lambda.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 25a4d6f..297327f 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -1519,8 +1519,8 @@ prune_lambda_captures (tree body) tree cap = *capp; if (tree var = var_to_maybe_prune (cap)) { - tree *use = *const_vars.get (var); - if (TREE_CODE (*use) == DECL_EXPR) + tree **use = const_vars.get (var); + if (use && TREE_CODE (**use) == DECL_EXPR) { /* All uses of this capture were folded away, leaving only the proxy declaration. */ @@ -1535,7 +1535,7 @@ prune_lambda_captures (tree body) *fieldp = DECL_CHAIN (*fieldp); /* And remove the capture proxy declaration. */ - *use = void_node; + **use = void_node; continue; } } |