public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Fix PR 57792
@ 2019-01-13 15:01 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2019-01-13 15:01 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

Hell world,

as part of the contiguous improvement process in gfortran, I have
committed the patch below as obvious.  gfortran now does not pack/unpack
if a function result is contiguous.

Regards

	Thomas


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

	PR fortran/57992
	* trans-array.c (gfc_conv_array_parameter):  Do not pack/unpack
	functions with contiguous results.

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

	PR fortran/57792
	* gfortran.dg/internal_pack_18.f90: New test.

[-- Attachment #2: p5.diff --]
[-- Type: text/x-patch, Size: 540 bytes --]

Index: trans-array.c
===================================================================
--- trans-array.c	(Revision 267903)
+++ trans-array.c	(Arbeitskopie)
@@ -7894,7 +7894,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr *
 	{
 	  gfc_symbol *result = expr->value.function.esym->result;
 	  if (result->attr.dimension
-	      && (result->as->type == AS_EXPLICIT || result->attr.allocatable))
+	      && (result->as->type == AS_EXPLICIT
+		  || result->attr.allocatable
+		  || result->attr.contiguous))
 	    no_pack = 1;
 	}
     }

[-- Attachment #3: internal_pack_18.f90 --]
[-- Type: text/x-fortran, Size: 473 bytes --]

! { dg-do compile }
! { dg-additional-options "-fdump-tree-original" }
! PR 57992 - this was packed/unpacked unnecessarily.
! Original case by Tobias Burnus.
subroutine test
  interface
    function f2()
      integer, pointer, contiguous :: f2(:)
    end function f2
  end interface

 call bar(f2())
end subroutine test
! { dg-final { scan-tree-dump-not "_gfortran_internal_pack" "original" } }
! { dg-final { scan-tree-dump-not "_gfortran_internal_unpack" "original" } }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-13 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 15:01 [patch, fortran, committed] Fix PR 57792 Thomas Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).