aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-simd-clone.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-02-05 11:32:37 +0100
committerJakub Jelinek <jakub@redhat.com>2020-02-05 11:32:37 +0100
commitb843bcb89519293404bb00d2ed09aae529b54d7f (patch)
treebcc9c051915ffe04939c1c31d9460d9bcf97d08f /gcc/omp-simd-clone.c
parent27736735f6fcba464b90c3a9dff13b7e5c8bdc6e (diff)
downloadgcc-b843bcb89519293404bb00d2ed09aae529b54d7f.zip
gcc-b843bcb89519293404bb00d2ed09aae529b54d7f.tar.gz
gcc-b843bcb89519293404bb00d2ed09aae529b54d7f.tar.bz2
openmp: Avoid ICEs with declare simd; declare simd inbranch [PR93555]
The testcases ICE because when processing the declare simd inbranch, we don't create the i == 0 clone as it already exists, which means clone_info->nargs is not adjusted, but we then rely on it being adjusted when trying other clones. 2020-02-05 Jakub Jelinek <jakub@redhat.com> PR middle-end/93555 * omp-simd-clone.c (expand_simd_clones): If simd_clone_mangle or simd_clone_create failed when i == 0, adjust clone->nargs by clone->inbranch. * c-c++-common/gomp/pr93555-1.c: New test. * c-c++-common/gomp/pr93555-2.c: New test. * gfortran.dg/gomp/pr93555.f90: New test.
Diffstat (limited to 'gcc/omp-simd-clone.c')
-rw-r--r--gcc/omp-simd-clone.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c
index 8e6cee1..71ff034 100644
--- a/gcc/omp-simd-clone.c
+++ b/gcc/omp-simd-clone.c
@@ -1713,14 +1713,22 @@ expand_simd_clones (struct cgraph_node *node)
already. */
tree id = simd_clone_mangle (node, clone);
if (id == NULL_TREE)
- continue;
+ {
+ if (i == 0)
+ clone->nargs += clone->inbranch;
+ continue;
+ }
/* Only when we are sure we want to create the clone actually
clone the function (or definitions) or create another
extern FUNCTION_DECL (for prototypes without definitions). */
struct cgraph_node *n = simd_clone_create (node);
if (n == NULL)
- continue;
+ {
+ if (i == 0)
+ clone->nargs += clone->inbranch;
+ continue;
+ }
n->simdclone = clone;
clone->origin = node;