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.
This commit is contained in:
parent
27736735f6
commit
b843bcb895
6 changed files with 70 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
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.
|
||||
|
||||
2020-02-05 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR c++/92717
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
|
||||
2020-02-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/93555
|
||||
* 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.
|
||||
|
||||
2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
|
||||
|
||||
* g++.dg/coroutines/co-await-14-return-ref-to-auto.C: New test.
|
||||
|
||||
|
|
18
gcc/testsuite/c-c++-common/gomp/pr93555-1.c
Normal file
18
gcc/testsuite/c-c++-common/gomp/pr93555-1.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* PR middle-end/93555 */
|
||||
/* { dg-do compile } */
|
||||
|
||||
#pragma omp declare simd
|
||||
#pragma omp declare simd inbranch
|
||||
int
|
||||
foo (int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
#pragma omp declare simd inbranch
|
||||
#pragma omp declare simd
|
||||
int
|
||||
bar (int x)
|
||||
{
|
||||
return x;
|
||||
}
|
16
gcc/testsuite/c-c++-common/gomp/pr93555-2.c
Normal file
16
gcc/testsuite/c-c++-common/gomp/pr93555-2.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* PR middle-end/93555 */
|
||||
/* { dg-do compile } */
|
||||
|
||||
#pragma omp declare simd
|
||||
#pragma omp declare simd inbranch
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
}
|
||||
|
||||
#pragma omp declare simd inbranch
|
||||
#pragma omp declare simd
|
||||
void
|
||||
bar (void)
|
||||
{
|
||||
}
|
11
gcc/testsuite/gfortran.dg/gomp/pr93555.f90
Normal file
11
gcc/testsuite/gfortran.dg/gomp/pr93555.f90
Normal file
|
@ -0,0 +1,11 @@
|
|||
! PR middle-end/93555
|
||||
! { dg-do compile }
|
||||
|
||||
subroutine foo
|
||||
!$omp declare simd(foo)
|
||||
!$omp declare simd(foo) inbranch
|
||||
end
|
||||
subroutine bar
|
||||
!$omp declare simd(bar) inbranch
|
||||
!$omp declare simd(bar)
|
||||
end
|
Loading…
Add table
Reference in a new issue