diff --git a/gcc/omp-transform-loops.cc b/gcc/omp-transform-loops.cc
index 517faea537c..275a5260dae 100644
--- a/gcc/omp-transform-loops.cc
+++ b/gcc/omp-transform-loops.cc
@@ -548,6 +548,7 @@ full_unroll (gomp_for *omp_for, location_t loc, walk_ctx *ctx ATTRIBUTE_UNUSED)

   gimple_seq unrolled = NULL;
   gimple_seq_add_seq (&unrolled, gimple_omp_for_pre_body (omp_for));
+  gimplify_assign (index, init, &unrolled);
   push_gimplify_context ();
   gimple_seq_add_seq (&unrolled,
                      build_unroll_body (body, unroll_factor, index, incr));
diff --git a/libgomp/testsuite/libgomp.c++/loop-transforms/matrix-no-directive-unroll-full-1.C b/libgomp/testsuite/libgomp.c++/loop-transforms/matrix-no-directive-unroll-full-1.C
new file mode 100644
index 00000000000..3a684219627
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/loop-transforms/matrix-no-directive-unroll-full-1.C
@@ -0,0 +1,13 @@
+/* { dg-additional-options { -O0 -fdump-tree-original -Wall -Wno-unknown-pragmas } } */
+
+#define COMMON_DIRECTIVE
+#define COMMON_TOP_TRANSFORM omp unroll full
+#define COLLAPSE_1
+#define COLLAPSE_2
+#define COLLAPSE_3
+#define IMPLEMENTATION_FILE "../../libgomp.c-c++-common/loop-transforms/matrix-constant-iter.h"
+
+#include "../../libgomp.c-c++-common/loop-transforms/matrix-transform-variants-1.h"
+
+/* A consistency check to prevent broken macro usage. */
+/* { dg-final { scan-tree-dump-times "unroll_full" 13 "original" } } */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-1.c
index 9f7f02041b0..7904a5617f3 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-1.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options {-fdump-tree-original} } */
+/* { dg-additional-options { -fdump-tree-original -Wall -Wno-unknown-pragmas } } */

 #define COMMON_DIRECTIVE
 #define COLLAPSE_1 collapse(1)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-unroll-full-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-unroll-full-1.c
index 5dd0b5d2989..bd431a25102 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-unroll-full-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-unroll-full-1.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options {-fdump-tree-original} } */
+/* { dg-additional-options { -O2 -fdump-tree-original -Wall -Wno-unknown-pragmas } } */

 #define COMMON_DIRECTIVE
 #define COMMON_TOP_TRANSFORM omp unroll full
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-distribute-parallel-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-distribute-parallel-for-1.c
index d855857e5ee..3875014dc96 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-distribute-parallel-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-distribute-parallel-for-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE "omp teams distribute parallel for"
 #define COLLAPSE_1 "collapse(1)"
 #define COLLAPSE_2 "collapse(2)"
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-for-1.c
index f2a2b80b2fd..671396cd533 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-for-1.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options {-fdump-tree-original} } */
+/* { dg-additional-options { -fdump-tree-original -Wall -Wno-unknown-pragmas } } */

 #define COMMON_DIRECTIVE omp for
 #define COLLAPSE_1 collapse(1)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-for-1.c
index 2c5701efca4..cc66df42679 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-for-1.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options {-fdump-tree-original} } */
+/* { dg-additional-options { -fdump-tree-original -Wall -Wno-unknown-pragmas } } */

 #define COMMON_DIRECTIVE omp parallel for
 #define COLLAPSE_1 collapse(1)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-1.c
index e2def212725..890b460f374 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp parallel masked taskloop
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-simd-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-simd-1.c
index ce601555cfb..74f6271504a 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-simd-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-simd-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp parallel masked taskloop simd
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-parallel-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-parallel-for-1.c
index 365b39ba385..8138ea57f38 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-parallel-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-parallel-for-1.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options {-fdump-tree-original} } */
+/* { dg-additional-options { -fdump-tree-original -Wall -Wno-unknown-pragmas } } */

 #define COMMON_DIRECTIVE omp target parallel for map(tofrom:result[0:dim0*dim1]) map(to:matrix1[0:dim0*dim1], matrix2[0:dim0*dim1])
 #define COLLAPSE_1 collapse(1)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-teams-distribute-parallel-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-teams-distribute-parallel-for-1.c
index 8afe34874c9..d4d162d9c2b 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-teams-distribute-parallel-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-teams-distribute-parallel-for-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp target teams distribute parallel for map(tofrom:result[:dim0*dim1]) map(to:matrix1[0:dim0*dim1], matrix2[0:dim0*dim1])
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-taskloop-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-taskloop-1.c
index bbc78b39db0..28edb6ce83e 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-taskloop-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-taskloop-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp taskloop
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-teams-distribute-parallel-for-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-teams-distribute-parallel-for-1.c
index 3a58e479374..481a20a18d0 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-teams-distribute-parallel-for-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-teams-distribute-parallel-for-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp teams distribute parallel for
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-simd-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-simd-1.c
index e5155dcf76d..200ddd859f5 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-simd-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/matrix-simd-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #define COMMON_DIRECTIVE omp simd
 #define COLLAPSE_1 collapse(1)
 #define COLLAPSE_2 collapse(2)
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-1.c
index 2ac0fff16af..eb5d3d77eb8 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #include <stdio.h>

 int compute_sum1 ()
@@ -11,7 +13,7 @@ int compute_sum1 ()
     sum++;

   if (j != 7)
-    __builtin_abort;
+    __builtin_abort ();

   return sum;
 }
@@ -27,7 +29,7 @@ int compute_sum2()
     sum++;

   if (j != 7)
-    __builtin_abort;
+    __builtin_abort ();

   return sum;
 }
@@ -43,7 +45,7 @@ int compute_sum3()
     sum++;

   if (j != 7)
-    __builtin_abort;
+    __builtin_abort ();

   return sum;
 }
diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-non-rect-1.c b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-non-rect-1.c
index 2f9924aea1f..7bd9b906235 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-non-rect-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/loop-transforms/unroll-non-rect-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options { -Wall -Wno-unknown-pragmas } } */
+
 #include <stdio.h>
 #include <stdlib.h>

