]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/59345 (_gfortran_internal_pack on compiler generated temps)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 11 Jan 2019 06:32:10 +0000 (06:32 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 11 Jan 2019 06:32:10 +0000 (06:32 +0000)
2019-01-11  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/59345
* trans-array.c (gfc_conv_parameter_array):  Temporary
arrays generated for expressions do not need to be repacked.

2019-01-11  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/59345
* gfortran.dg/internal_pack_16.f90: New test.

From-SVN: r267829

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

index 678970b4621efa74de75d6f1cd1823737b3b4ee6..6c5e19576a8138ef28f7fbc749a7268d69ae51f0 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-11  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/59345
+       * trans-array.c (gfc_conv_parameter_array):  Temporary
+       arrays generated for expressions do not need to be repacked.
+
 2019-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/86322
index e71e76ee9cf06dd1e869dae1c5e35bfe4031de43..af3a2d838ab4d5241fed006c889216111a2d33ad 100644 (file)
@@ -7866,6 +7866,12 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
 
   no_pack = contiguous && no_pack;
 
+  /* If we have an expression, an array temporary will be
+     generated which does not need to be packed / unpacked
+     if passed to an explicit-shape dummy array.  */
+
+  no_pack = no_pack || (g77 && expr->expr_type == EXPR_OP);
+
   /* Array constructors are always contiguous and do not need packing.  */
   array_constructor = g77 && !this_array_result && expr->expr_type == EXPR_ARRAY;
 
index 018fa7675a441382bde805315de2248f7cbcb008..80e0b1ab74297352e081df229716e70a102b2515 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-11  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/59345
+       * gfortran.dg/internal_pack_16.f90: New test.
+
 2019-01-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/88785
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_16.f90 b/gcc/testsuite/gfortran.dg/internal_pack_16.f90
new file mode 100644 (file)
index 0000000..7e34c2b
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+! PR 59345 - pack/unpack was not needed here.
+SUBROUTINE S1(A)
+ REAL :: A(3)
+ CALL S2(-A)
+END SUBROUTINE
+! { dg-final { scan-tree-dump-not "_gfortran_internal_pack" "original" } }
+! { dg-final { scan-tree-dump-not "_gfortran_internal_unpack" "original" } }