]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/77665 (ICE in expand_GOMP_SIMD_VF, at internal...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:28:40 +0000 (09:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:28:40 +0000 (09:28 +0200)
Backported from mainline
2016-09-22  Jakub Jelinek  <jakub@redhat.com>

PR fortran/77665
* tree-inline.c (remap_gimple_stmt): Set has_simduid_loops
for all IFN_GOMP_SIMD_* internal fns.

* gfortran.dg/gomp/pr77665.f90: New test.

From-SVN: r248612

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr77665.f90 [new file with mode: 0644]
gcc/tree-inline.c

index df789e32f24f3446552344c510a2a2d23ee6688f..2469b119dd4957be384a3b1da48781d0714d50cb 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77665
+       * tree-inline.c (remap_gimple_stmt): Set has_simduid_loops
+       for all IFN_GOMP_SIMD_* internal fns.
+
        2016-09-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/77624
index 0192f663886a462d85e21b643dab0c9fe62f23b2..01905bceff81bce1fbd5db3233da669f3f295a20 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77665
+       * gfortran.dg/gomp/pr77665.f90: New test.
+
        2016-09-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/77637
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77665.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77665.f90
new file mode 100644 (file)
index 0000000..50183cb
--- /dev/null
@@ -0,0 +1,18 @@
+! PR fortran/77665
+! { dg-do compile }
+! { dg-additional-options "-O2" }
+
+program pr77665
+  type t
+    integer :: a = 0
+  end type
+  type(t) :: x
+  integer :: i
+  !$omp declare reduction (+:t: omp_out%a = omp_out%a + omp_in%a)
+  !$omp simd reduction(+:x)
+  do i = 1, 8
+    if (abs(i) < 5) call abort
+    x%a = x%a + 1
+  end do
+  print *, x%a
+end
index 60f79336cd7edd8ff946007e986366ba5dced749..ce961d665ab0ad570634f4e8b22c537636e9de98 100644 (file)
@@ -1644,6 +1644,17 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
            gimple_call_set_tail (call_stmt, false);
          if (gimple_call_from_thunk_p (call_stmt))
            gimple_call_set_from_thunk (call_stmt, false);
+         if (gimple_call_internal_p (call_stmt))
+           switch (gimple_call_internal_fn (call_stmt))
+             {
+             case IFN_GOMP_SIMD_LANE:
+             case IFN_GOMP_SIMD_VF:
+             case IFN_GOMP_SIMD_LAST_LANE:
+               DECL_STRUCT_FUNCTION (id->dst_fn)->has_simduid_loops = true;
+               break;
+             default:
+               break;
+             }
        }
 
       /* Remap the region numbers for __builtin_eh_{pointer,filter},