diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-01-24 21:56:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-01-24 21:56:45 +0100 |
commit | 4288fea21277dfd56522378ce31ae2461a299303 (patch) | |
tree | 75c43a7ce945db56bb7724178a49aded220ffc57 /gcc | |
parent | 3d55c64b495dd49e7b91b451837d93a380764af2 (diff) | |
download | gcc-4288fea21277dfd56522378ce31ae2461a299303.zip gcc-4288fea21277dfd56522378ce31ae2461a299303.tar.gz gcc-4288fea21277dfd56522378ce31ae2461a299303.tar.bz2 |
re PR middle-end/30494 (ICE with VLA and openmp)
PR middle-end/30494
* gimplify.c (omp_add_variable): Don't call omp_notice_variable
on TYPE_SIZE_UNIT for GOVD_LOCAL VLAs.
* gcc.dg/gomp/pr30494.c: New test.
* g++.dg/gomp/pr30494.C: New test.
* testsuite/libgomp.c/pr30494.c: New test.
From-SVN: r121132
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/gimplify.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/pr30494.C | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/pr30494.c | 30 |
5 files changed, 73 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 252b419..8d5d411 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2007-01-24 Jakub Jelinek <jakub@redhat.com> + PR middle-end/30494 + * gimplify.c (omp_add_variable): Don't call omp_notice_variable + on TYPE_SIZE_UNIT for GOVD_LOCAL VLAs. + PR middle-end/30421 * omp-low.c (lower_omp_for_lastprivate): Add dlist argument. If lower_lastprivate_clauses emits some statements, append them diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d14e01e..be02fb2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4505,8 +4505,11 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) /* We're going to make use of the TYPE_SIZE_UNIT at least in the alloca statement we generate for the variable, so make sure it is available. This isn't automatically needed for the SHARED - case, since we won't be allocating local storage then. */ - else + case, since we won't be allocating local storage then. + For local variables TYPE_SIZE_UNIT might not be gimplified yet, + in this case omp_notice_variable will be called later + on when it is gimplified. */ + else if (! (flags & GOVD_LOCAL)) omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true); } else if (lang_hooks.decls.omp_privatize_by_reference (decl)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2d9fc84..fcb4e74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2007-01-24 Jakub Jelinek <jakub@redhat.com> + PR middle-end/30494 + * gcc.dg/gomp/pr30494.c: New test. + * g++.dg/gomp/pr30494.C: New test. + PR middle-end/30421 * gcc.dg/gomp/pr30421.c: New test. diff --git a/gcc/testsuite/g++.dg/gomp/pr30494.C b/gcc/testsuite/g++.dg/gomp/pr30494.C new file mode 100644 index 0000000..3f2d120 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr30494.C @@ -0,0 +1,30 @@ +// PR middle-end/30494 +// { dg-do compile } + +int +foo (int n) +{ + int i; +#pragma omp for + for (i = 0; i < 6; i++) + { + int v[n], w[n * 3 + i]; + v[0] = 1; + w[0] = 2; + } + return 0; +} + +int +bar (int n) +{ + int i; +#pragma parallel omp for + for (i = 0; i < 6; i++) + { + int v[n], w[n * 3 + i]; + v[0] = 1; + w[0] = 2; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr30494.c b/gcc/testsuite/gcc.dg/gomp/pr30494.c new file mode 100644 index 0000000..6a042ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr30494.c @@ -0,0 +1,30 @@ +/* PR middle-end/30494 */ +/* { dg-do compile } */ + +int +foo (int n) +{ + int i; +#pragma omp for + for (i = 0; i < 6; i++) + { + int v[n], w[n * 3 + i]; + v[0] = 1; + w[0] = 2; + } + return 0; +} + +int +bar (int n) +{ + int i; +#pragma parallel omp for + for (i = 0; i < 6; i++) + { + int v[n], w[n * 3 + i]; + v[0] = 1; + w[0] = 2; + } + return 0; +} |