Patchwork [Fortran-dev,committed] scan-dump fix, iso_ts29113.c lower_bound corrections

login
register
mail settings
Submitter Tobias Burnus
Date May 2, 2013, 10:33 a.m.
Message ID <5182410F.1050500@net-b.de>
Download mbox | patch
Permalink /patch/240933/
State New
Headers show

Comments

Tobias Burnus - May 2, 2013, 10:33 a.m.
I have committed the attached patch to the Fortran-dev branch (Rev. 198513).

Dump scan: Using scan-tree-dump-times does not seem to handle patterns; 
thus, scan-tree-dump is now used.

runtime/iso_ts29113.c: Correctly set lower_bound for CFI_establish and 
CFI_select_part, I think it should now match the standard. For 
CFI_is_contiguous, I missed to handle negative strides.

Tobias

Patch

Index: gcc/testsuite/ChangeLog.fortran-dev
===================================================================
--- gcc/testsuite/ChangeLog.fortran-dev	(Revision 198512)
+++ gcc/testsuite/ChangeLog.fortran-dev	(Arbeitskopie)
@@ -1,3 +1,7 @@ 
+2013-05-02  Tobias Burnus  <burnus@net-b.de>
+
+	* gfortran.dg/iso-ts-29113_2.f90: Update scan-dump.
+
 2013-04-30  Tobias Burnus  <burnus@net-b.de>
 
 	* gfortran.dg/iso-ts-29113_2.f90: New.
Index: gcc/testsuite/gfortran.dg/iso-ts-29113_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/iso-ts-29113_2.f90	(Revision 198512)
+++ gcc/testsuite/gfortran.dg/iso-ts-29113_2.f90	(Arbeitskopie)
@@ -125,8 +125,8 @@ 
 ! { dg-final { scan-tree-dump-times "x_str1b.type = 261;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "x_str4a.type = 1029;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "x_str4b.type = 1029;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "x_cptr.type = (1025|2049);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "x_funcptr.type = (1025|2049);" 1 "original" } }
+! { dg-final { scan-tree-dump       "x_cptr.type = (1025|2049);"  "original" } }
+! { dg-final { scan-tree-dump       "x_funcptr.type = (1025|2049);" "original" } }
 ! { dg-final { scan-tree-dump-times "x_seq.type = 6;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "x_bindc.type = 6;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "x_ext.type = -1;" 1 "original" } }
Index: libgfortran/ChangeLog.fortran-dev
===================================================================
--- libgfortran/ChangeLog.fortran-dev	(Revision 198512)
+++ libgfortran/ChangeLog.fortran-dev	(Arbeitskopie)
@@ -1,3 +1,9 @@ 
+2013-05-02  Tobias Burnus  <burnus@net-b.de>
+
+	* runtime/iso_ts29113.c (CFI_establish, CFI_select_part):
+	Correctly set lower_bound.
+	(CFI_is_contiguous): Handle negative strides.
+
 2013-04-30  Tobias Burnus  <burnus@net-b.de>
 
 	* ISO_Fortran_binding.h.tmpl (CFI_cdesc_t): Change order
Index: libgfortran/runtime/iso_ts29113.c
===================================================================
--- libgfortran/runtime/iso_ts29113.c	(Revision 198512)
+++ libgfortran/runtime/iso_ts29113.c	(Arbeitskopie)
@@ -169,7 +169,7 @@ 
   sm = dv->elem_len;
   for (i = 0; i < rank; i++)
     {
-      dv->dim[i].lower_bound = 0; /* Note: Only required for pointers.  */
+      dv->dim[i].lower_bound = 0;
       dv->dim[i].extent = extents[i];
       dv->dim[i].sm = sm;
       sm *= extents[i];
@@ -196,7 +196,7 @@ 
   size = dv->elem_len;
   for (i = 1; i < dv->rank; i++)
     {
-      if (size < dv->dim[i].sm)
+      if (size < dv->dim[i].sm || dv->dim[i].sm < 0)
 	return 0;
       size *= dv->dim[i].sm;
     }
@@ -314,8 +314,7 @@ 
 
   for (i = 1; i < result->rank; i++)
    {
-      result->dim[i].lower_bound = result->attribute == CFI_attribute_other
-				   ? 0 : source->dim[i].lower_bound;
+      result->dim[i].lower_bound = source->dim[i].lower_bound;
       result->dim[i].extent = source->dim[i].extent;
       result->dim[i].sm = source->dim[i].sm;
     }