re PR middle-end/71758 (ICE in verify_gimple_in_cfg, at tree-cfg.c:5212)
authorJakub Jelinek <jakub@redhat.com>
Mon, 11 Jul 2016 20:40:47 +0000 (22:40 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 11 Jul 2016 20:40:47 +0000 (22:40 +0200)
PR middle-end/71758
* omp-low.c (expand_omp_target): Gimplify device.

* c-c++-common/gomp/pr71758.c: New test.
* gfortran.dg/gomp/pr71758.f90: New test.

From-SVN: r238231

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/pr71758.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr71758.f90 [new file with mode: 0644]

index ac3f065e1b13c02f0167333c4f535c7afe7079ea..7252ef87846d4c7e37b41d14b85e39930981d8d8 100644 (file)
@@ -1,5 +1,8 @@
 2016-07-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/71758
+       * omp-low.c (expand_omp_target): Gimplify device.
+
        PR tree-optimization/71823
        * tree-vect-stmts.c (vectorizable_operation): Use vect_get_vec_defs
        to get vec_oprnds2 from op2.
index b89978f77236edbaeaebdebd6dc4d12d799807d8..ecba096c5c169bb4933937339efdb7851240b2c0 100644 (file)
@@ -13350,9 +13350,15 @@ expand_omp_target (struct omp_region *region)
       make_edge (else_bb, new_bb, EDGE_FALLTHRU);
 
       device = tmp_var;
+      gsi = gsi_last_bb (new_bb);
+    }
+  else
+    {
+      gsi = gsi_last_bb (new_bb);
+      device = force_gimple_operand_gsi (&gsi, device, true, NULL_TREE,
+                                        true, GSI_SAME_STMT);
     }
 
-  gsi = gsi_last_bb (new_bb);
   t = gimple_omp_target_data_arg (entry_stmt);
   if (t == NULL)
     {
index 067370114c91a57f4fb5525d5e9e3b8c44147d53..a171ad874e9dd4e88048301353ffcaeca7abb580 100644 (file)
@@ -1,5 +1,9 @@
 2016-07-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/71758
+       * c-c++-common/gomp/pr71758.c: New test.
+       * gfortran.dg/gomp/pr71758.f90: New test.
+
        PR tree-optimization/71823
        * gcc.dg/vect/pr71823.c: New test.
 
diff --git a/gcc/testsuite/c-c++-common/gomp/pr71758.c b/gcc/testsuite/c-c++-common/gomp/pr71758.c
new file mode 100644 (file)
index 0000000..d3c8697
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR middle-end/71758 */
+
+void
+foo (int *p)
+{
+  long long i = 0;
+  #pragma omp target device (i)
+  ;
+  #pragma omp target update device (i) to (p[0])
+}
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr71758.f90 b/gcc/testsuite/gfortran.dg/gomp/pr71758.f90
new file mode 100644 (file)
index 0000000..47215ba
--- /dev/null
@@ -0,0 +1,10 @@
+! PR middle-end/71758
+
+subroutine pr71758 (p)
+  integer(8) :: i
+  integer :: p(20)
+  i = 0
+  !$omp target device(i)
+  !$omp end target
+  !$omp target update to(p(1:1)) device(i)
+end subroutine