diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2023-09-07 16:12:20 +0000 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2023-09-07 17:51:03 +0000 |
commit | ab4bdad49716eb1c60e22e0e617d5eb56b0bac6f (patch) | |
tree | 69eac9789c005f6e0d95f05e595bd2d0057b0fa5 /gcc/cp | |
parent | 64fad6a494c42d822cd7d6e3a0ec1e29e1045060 (diff) | |
download | gcc-ab4bdad49716eb1c60e22e0e617d5eb56b0bac6f.zip gcc-ab4bdad49716eb1c60e22e0e617d5eb56b0bac6f.tar.gz gcc-ab4bdad49716eb1c60e22e0e617d5eb56b0bac6f.tar.bz2 |
OpenMP: Fix ICE in fixup_blocks_walker [PR111274]
This ICE was caused by an invalid assumption that all BIND_EXPRs have
a non-null BIND_EXPR_BLOCK. In C++ these do exist and are used for
temporaries introduced in expressions that are not full-expressions.
Since they have no block to fix up, the traversal can just ignore
these tree nodes.
gcc/cp/ChangeLog
PR c++/111274
* parser.cc (fixup_blocks_walker): Check for null BIND_EXPR_BLOCK.
gcc/testsuite/ChangeLog
PR c++/111274
* g++.dg/gomp/pr111274.C: New test case.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/parser.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index ed0675c..8808da3 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -44490,7 +44490,10 @@ fixup_blocks_walker (tree *tp, int *walk_subtrees, void *dp) { tree superblock = *(tree *)dp; - if (TREE_CODE (*tp) == BIND_EXPR) + /* BIND_EXPR_BLOCK may be null if the expression is not a + full-expression; if there's no block, no patching is necessary + for this node. */ + if (TREE_CODE (*tp) == BIND_EXPR && BIND_EXPR_BLOCK (*tp)) { tree block = BIND_EXPR_BLOCK (*tp); if (superblock) |