From 3088d40408d9c26ace497e6a01badc53cde9ffb7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 4 Apr 2008 19:48:45 +0200 Subject: [PATCH] re PR target/35364 (ICE on ia64 with vector declaration inside #pragma omp parallel) PR target/35364 * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. * g++.dg/gomp/pr35364.C: New test. From-SVN: r133905 --- gcc/ChangeLog | 5 +++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/gomp/pr35364.C | 50 +++++++++++++++++++++++++++++ gcc/tree-cfg.c | 27 ++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 gcc/testsuite/g++.dg/gomp/pr35364.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f52f12be54a..79fb7738531 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-04-04 Jakub Jelinek + + PR target/35364 + * tree-cfg.c (remove_useless_stmts_1): Handle OMP_* containers. + 2008-04-04 H.J. Lu * config.gcc (extra_headers): Add wmmintrin.h for x86 and x86-64. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ec1c2df538..5a203d1c139 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-04 Jakub Jelinek + + PR target/35364 + * g++.dg/gomp/pr35364.C: New test. + 2008-04-04 H.J. Lu * g++.dg/other/i386-2.C: Include . diff --git a/gcc/testsuite/g++.dg/gomp/pr35364.C b/gcc/testsuite/g++.dg/gomp/pr35364.C new file mode 100644 index 00000000000..da60d5debfc --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr35364.C @@ -0,0 +1,50 @@ +// PR target/35364 +// { dg-do compile } +// { dg-options "-O2 -fopenmp" } + +template +struct E +{ + E (); + ~E (); +}; + +template +struct C +{ + C (const U &y) : u (y) {} + ~C () {} + const U &u; +}; + +template > +struct B : public C +{ + B (int x, const T &z = T (), const U &y = U ()) : C (y) {} + ~B () {} +}; + +void +foo () +{ +#pragma omp parallel + { + B x (1); + } +#pragma omp for + for (int i = 0; i < 10; i++) + { + B x (i); + } +#pragma omp sections + { +#pragma omp section + { + B x (6); + } + } +#pragma omp single + { + B x (16); + } +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index cea11b8661c..7eea2e1f07a 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1917,6 +1917,33 @@ remove_useless_stmts_1 (tree *tp, struct rus_data *data) data->last_goto = NULL; break; + case OMP_PARALLEL: + /* Make sure the outermost BIND_EXPR in OMP_BODY isn't removed + as useless. */ + remove_useless_stmts_1 (&BIND_EXPR_BODY (OMP_BODY (*tp)), data); + data->last_goto = NULL; + break; + + case OMP_SECTIONS: + case OMP_SINGLE: + case OMP_SECTION: + case OMP_MASTER : + case OMP_ORDERED: + case OMP_CRITICAL: + remove_useless_stmts_1 (&OMP_BODY (*tp), data); + data->last_goto = NULL; + break; + + case OMP_FOR: + remove_useless_stmts_1 (&OMP_FOR_BODY (*tp), data); + data->last_goto = NULL; + if (OMP_FOR_PRE_BODY (*tp)) + { + remove_useless_stmts_1 (&OMP_FOR_PRE_BODY (*tp), data); + data->last_goto = NULL; + } + break; + default: data->last_goto = NULL; break; -- 2.30.2