diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 747ca3e73893aaf46299af28f8e1e1ee110de668..e3814ee9d06f065f20c93385cdafb501bdd5dabe 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4512,7 +4512,12 @@ expand_debug_expr (tree exp) op0 = DECL_RTL_IF_SET (exp); if (op0) - return op0; + { + if (GET_MODE (op0) != mode) + gcc_assert (VECTOR_TYPE_P (TREE_TYPE (exp))); + else + return op0; + } op0 = gen_rtx_DEBUG_EXPR (mode); DEBUG_EXPR_TREE_DECL (op0) = exp; diff --git a/gcc/testsuite/gcc.dg/gomp/pr100508.c b/gcc/testsuite/gcc.dg/gomp/pr100508.c new file mode 100644 index 0000000000000000000000000000000000000000..c3fa2fc258e03f152cfb2b39cb22304cb103008d --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr100508.c @@ -0,0 +1,14 @@ +/* PR middle-end/100508 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -fopenmp-simd" } */ + +typedef int __attribute__((__vector_size__(32))) V; +V j; + +#pragma omp declare simd +int +foo (void) +{ + V m = j; + return 0; +}