re PR fortran/82184 (187.facerec in SPEC CPU 2000 miscompares)
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 15 Sep 2017 07:26:14 +0000 (07:26 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 15 Sep 2017 07:26:14 +0000 (07:26 +0000)
2017-09-15  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/82184
trans-decl.c (gfc_trans_deferred_vars): Do not null the 'span'
field if the symbol is either implicitly or explicitly saved.

2017-09-15  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/82184
* gfortran.dg/pointer_array_9.f90: New test.

From-SVN: r252781

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pointer_array_9.f90 [new file with mode: 0644]

index 885fd06ef44c3d15d70cc23c2c436a6641206f24..8bdd6357af143a98ef734be18265ef000d2d2d4b 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-15  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/82184
+       trans-decl.c (gfc_trans_deferred_vars): Do not null the 'span'
+       field if the symbol is either implicitly or explicitly saved.
+
 2017-09-13  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/82173
index 830c53ac38414c22e190f311d139aa389d6d3a24..d227d519c63c66fab01a9a319a5c43300c47cf64 100644 (file)
@@ -4342,6 +4342,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
        }
 
       if (sym->attr.pointer && sym->attr.dimension
+         && sym->attr.save == SAVE_NONE
          && !sym->attr.use_assoc
          && !sym->attr.host_assoc
          && !sym->attr.dummy
index b6d0009b29c70185a84c86bd8572f53733f563bb..d98cdbf33cb54563805c795710b07a758ff9a055 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-15  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/82184
+       * gfortran.dg/pointer_array_9.f90: New test.
+
 2017-09-14  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/abs128-1.c: Use __builtin_fabsf128 instead of
diff --git a/gcc/testsuite/gfortran.dg/pointer_array_9.f90 b/gcc/testsuite/gfortran.dg/pointer_array_9.f90
new file mode 100644 (file)
index 0000000..a54a2b5
--- /dev/null
@@ -0,0 +1,23 @@
+! { dg-do run }
+!
+! Tests fix for PR82184
+!
+! Contributed by Andrey Guskov  <andrey.y.guskov@intel.com)
+!
+program r187
+  call s()
+  call s()
+contains
+  subroutine s()
+    complex(4), allocatable, save :: a(:, :)
+    complex(4), pointer,     save :: b(:, :)
+    if (.not. associated(b)) then
+      allocate(a(2, 2))
+      allocate(b(2, 2))
+      a = reshape ([cmplx(1, 1), cmplx(2, 2), cmplx(1, 2), cmplx(2, 1)], [2,2])
+    else
+      b = transpose(a)
+      if (merge("PASSED", "FAILED", all (transpose (a) .eq. b)) .eq. "FAILED") call abort
+    end if
+  end subroutine s
+end program r187