aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-09-10 09:35:56 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2015-09-10 09:35:56 +0200
commit9ce1688bb8b00bafc041e375b453d9f957cc1424 (patch)
treef51d0f7d9eee3b4530c7e4ea6af775f87749c576 /gcc/gimplify.c
parent7da8534d1e1ec7b1470ea556b1444c5173799348 (diff)
downloadgcc-9ce1688bb8b00bafc041e375b453d9f957cc1424.zip
gcc-9ce1688bb8b00bafc041e375b453d9f957cc1424.tar.gz
gcc-9ce1688bb8b00bafc041e375b453d9f957cc1424.tar.bz2
re PR c++/67523 (ICE with invalid combined simd inside of a template)
PR c++/67523 * gimplify.c (gimplify_omp_for): If inner stmt is not found for combined loop, assert seen_error () and return GS_ERROR. * g++.dg/gomp/pr67523.C: New test. From-SVN: r227611
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 5030318..10f84d4 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7001,7 +7001,7 @@ find_combined_omp_for (tree *tp, int *walk_subtrees, void *)
static enum gimplify_status
gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
{
- tree for_stmt, orig_for_stmt, decl, var, t;
+ tree for_stmt, orig_for_stmt, inner_for_stmt = NULL_TREE, decl, var, t;
enum gimplify_status ret = GS_ALL_DONE;
enum gimplify_status tret;
gomp_for *gfor;
@@ -7044,6 +7044,19 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
}
}
+ if (OMP_FOR_INIT (for_stmt) == NULL_TREE)
+ {
+ gcc_assert (TREE_CODE (for_stmt) != OACC_LOOP);
+ inner_for_stmt = walk_tree (&OMP_FOR_BODY (for_stmt),
+ find_combined_omp_for, NULL, NULL);
+ if (inner_for_stmt == NULL_TREE)
+ {
+ gcc_assert (seen_error ());
+ *expr_p = NULL_TREE;
+ return GS_ERROR;
+ }
+ }
+
gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p,
simd ? ORT_SIMD : ORT_WORKSHARE);
if (TREE_CODE (for_stmt) == OMP_DISTRIBUTE)
@@ -7079,10 +7092,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
if (OMP_FOR_INIT (for_stmt) == NULL_TREE)
{
- gcc_assert (TREE_CODE (for_stmt) != OACC_LOOP);
- for_stmt = walk_tree (&OMP_FOR_BODY (for_stmt), find_combined_omp_for,
- NULL, NULL);
- gcc_assert (for_stmt != NULL_TREE);
+ for_stmt = inner_for_stmt;
gimplify_omp_ctxp->combined_loop = true;
}