public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Fortran-dev][Patch] Fix cshift1
@ 2012-07-15  7:00 Tobias Burnus
  2012-07-15  8:52 ` Thomas Koenig
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-07-15  7:00 UTC (permalink / raw)
  To: gcc patches, gfortran

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

This patch fixes the stride setting for cshift1; hence, it fixes 
gfortran.dg/optional_dim_3.f90.

Build and regtested on x86-64-linux - 13 failing tests remain.
OK?

Tobias

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

2012-07-15  Tobias Burnus  <burnus@net-b.de>

	* m4/cshift1.m4 (cshift1): Correctly set stride multiplier.
	* generated/cshift1_16.c: Regenerate.
	* generated/cshift1_4.c: Regenerate.
	* generated/cshift1_8.c: Regenerate.

Index: libgfortran/m4/cshift1.m4
===================================================================
--- libgfortran/m4/cshift1.m4	(Revision 189480)
+++ libgfortran/m4/cshift1.m4	(Arbeitskopie)
@@ -80,22 +80,18 @@ cshift1 (gfc_array_char * const restrict ret,
   if (ret->base_addr == NULL)
     {
       int i;
+      index_type sm, ext;
 
       ret->base_addr = xmalloc (size * arraysize);
       ret->offset = 0;
       ret->dtype = array->dtype;
+      sm = sizeof ('atype_name`);
+      ext = 1;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
-	  index_type ext, sm;
-
+          sm *= ext;
           ext = GFC_DESCRIPTOR_EXTENT (array, i);
 
-          if (i == 0)
-            sm = 1;
-          else
-	    sm = GFC_DESCRIPTOR_EXTENT (ret, i-1)
-		 * GFC_DESCRIPTOR_SM (ret, i-1);
-
 	  GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
         }
     }
Index: libgfortran/generated/cshift1_16.c
===================================================================
--- libgfortran/generated/cshift1_16.c	(Revision 189480)
+++ libgfortran/generated/cshift1_16.c	(Arbeitskopie)
@@ -79,22 +79,18 @@ cshift1 (gfc_array_char * const restrict ret,
   if (ret->base_addr == NULL)
     {
       int i;
+      index_type sm, ext;
 
       ret->base_addr = xmalloc (size * arraysize);
       ret->offset = 0;
       ret->dtype = array->dtype;
+      sm = sizeof (GFC_INTEGER_16);
+      ext = 1;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
-	  index_type ext, sm;
-
+	  sm *= ext;
           ext = GFC_DESCRIPTOR_EXTENT (array, i);
 
-          if (i == 0)
-            sm = 1;
-          else
-	    sm = GFC_DESCRIPTOR_EXTENT (ret, i-1)
-		 * GFC_DESCRIPTOR_SM (ret, i-1);
-
 	  GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
         }
     }
Index: libgfortran/generated/cshift1_4.c
===================================================================
--- libgfortran/generated/cshift1_4.c	(Revision 189480)
+++ libgfortran/generated/cshift1_4.c	(Arbeitskopie)
@@ -79,22 +79,18 @@ cshift1 (gfc_array_char * const restrict ret,
   if (ret->base_addr == NULL)
     {
       int i;
+      index_type sm, ext;
 
       ret->base_addr = xmalloc (size * arraysize);
       ret->offset = 0;
       ret->dtype = array->dtype;
+      sm = sizeof (GFC_INTEGER_4);
+      ext = 1;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
-	  index_type ext, sm;
-
+	  sm *= ext;
           ext = GFC_DESCRIPTOR_EXTENT (array, i);
 
-          if (i == 0)
-            sm = 1;
-          else
-	    sm = GFC_DESCRIPTOR_EXTENT (ret, i-1)
-		 * GFC_DESCRIPTOR_SM (ret, i-1);
-
 	  GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
         }
     }
Index: libgfortran/generated/cshift1_8.c
===================================================================
--- libgfortran/generated/cshift1_8.c	(Revision 189480)
+++ libgfortran/generated/cshift1_8.c	(Arbeitskopie)
@@ -79,22 +79,18 @@ cshift1 (gfc_array_char * const restrict ret,
   if (ret->base_addr == NULL)
     {
       int i;
+      index_type sm, ext;
 
       ret->base_addr = xmalloc (size * arraysize);
       ret->offset = 0;
       ret->dtype = array->dtype;
+      sm = sizeof (GFC_INTEGER_8);
+      ext = 1;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
-	  index_type ext, sm;
-
+	  sm *= ext;
           ext = GFC_DESCRIPTOR_EXTENT (array, i);
 
-          if (i == 0)
-            sm = 1;
-          else
-	    sm = GFC_DESCRIPTOR_EXTENT (ret, i-1)
-		 * GFC_DESCRIPTOR_SM (ret, i-1);
-
 	  GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
         }
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Fortran-dev][Patch] Fix cshift1
  2012-07-15  7:00 [Fortran-dev][Patch] Fix cshift1 Tobias Burnus
@ 2012-07-15  8:52 ` Thomas Koenig
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Koenig @ 2012-07-15  8:52 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches, gfortran

Hi Tobias,

> This patch fixes the stride setting for cshift1; hence, it fixes
> gfortran.dg/optional_dim_3.f90.
>
> Build and regtested on x86-64-linux - 13 failing tests remain.
> OK?

OK. Thanks for the patch!

	Thomas


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-15  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-15  7:00 [Fortran-dev][Patch] Fix cshift1 Tobias Burnus
2012-07-15  8:52 ` 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).