2019-08-30 Jakub Jelinek Backported from mainline 2019-01-29 Jakub Jelinek PR c++/66676 PR ipa/89104 * omp-simd-clone.c (simd_clone_clauses_extract) : Ignore clauses with NULL OMP_CLAUSE_ALIGNED_ALIGNMENT. * gcc.dg/gomp/pr89104.c: New test. --- gcc/omp-simd-clone.c (revision 268635) +++ gcc/omp-simd-clone.c (revision 268636) @@ -242,6 +242,10 @@ simd_clone_clauses_extract (struct cgrap } case OMP_CLAUSE_ALIGNED: { + /* Ignore aligned (x) for declare simd, for the ABI we really + need an alignment specified. */ + if (OMP_CLAUSE_ALIGNED_ALIGNMENT (t) == NULL_TREE) + break; tree decl = OMP_CLAUSE_DECL (t); int argno = tree_to_uhwi (decl); clone_info->args[argno].alignment --- gcc/testsuite/gcc.dg/gomp/pr89104.c (nonexistent) +++ gcc/testsuite/gcc.dg/gomp/pr89104.c (revision 268636) @@ -0,0 +1,11 @@ +/* PR c++/66676 */ +/* PR ipa/89104 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd" } */ + +#pragma omp declare simd uniform (x) aligned (x) +int +foo (int *x, int y) +{ + return x[y]; +}