diff mbox

[Fortran-dev,committed] Fix C_F_POINTER

Message ID 515824DB.4080108@net-b.de
State New
Headers show

Commit Message

Tobias Burnus March 31, 2013, 11:58 a.m. UTC
This patch fixes a merge issue (trans-expr.c code was moved to 
trans-intrinsic.c on the trunk, and the branch was slightly different).

One teststuite failure turned out to be due to debugging code on the 
branch - and I moved to the trunk version.

Tobias
diff mbox

Patch

Index: gcc/fortran/ChangeLog.fortran-dev
===================================================================
--- gcc/fortran/ChangeLog.fortran-dev	(Revision 197283)
+++ gcc/fortran/ChangeLog.fortran-dev	(Arbeitskopie)
@@ -1,5 +1,10 @@ 
 2013-03-31  Tobias Burnus  <burnus@net-b.de>
 
+	* trans-intrinsic.c (conv_isocbinding_subroutine): Fix
+	merge-resolution bug.
+
+2013-03-31  Tobias Burnus  <burnus@net-b.de>
+
 	* trans-array.c (VERSION_FIELD): New define.
 	(ELEM_LEN_FIELD): Renamed from SIZE_FIELD, reordered the fields.
 	(gfc_build_null_descriptor): Also set version field (to 1).
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(Revision 197283)
+++ gcc/fortran/trans-intrinsic.c	(Arbeitskopie)
@@ -6467,6 +6467,10 @@  conv_isocbinding_subroutine (gfc_code *code)
   tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR,
 			 gfc_array_index_type, sm,
 			 fold_convert (TREE_TYPE (sm), tmp));
+  gfc_add_modify (&body, offset,
+		  fold_build2_loc (input_location, PLUS_EXPR,
+				   gfc_array_index_type, offset, tmp));
+
   /* Update stride multiplier.  */
   gfc_add_modify (&body, sm,
 		  fold_build2_loc (input_location, MULT_EXPR,
Index: gcc/testsuite/ChangeLog.fortran-dev
===================================================================
--- gcc/testsuite/ChangeLog.fortran-dev	(Revision 197283)
+++ gcc/testsuite/ChangeLog.fortran-dev	(Arbeitskopie)
@@ -1,3 +1,7 @@ 
+2013-03-31  Tobias Burnus  <burnus@net-b.de>
+
+	* gfortran.dg/c_f_pointer_tests.f90: Move to trunk version.
+
 2012-07-20  Tobias Burnus  <burnus@net-b.de>
 
 	* gfortran.dg/c_f_pointer_tests_3.f90: Update scan-tree-dump
Index: gcc/testsuite/gfortran.dg/c_f_pointer_tests.f90
===================================================================
--- gcc/testsuite/gfortran.dg/c_f_pointer_tests.f90	(Revision 197283)
+++ gcc/testsuite/gfortran.dg/c_f_pointer_tests.f90	(Arbeitskopie)
@@ -53,22 +53,16 @@  module c_f_pointer_tests
     shapeArray(1) = arrayLen
     call c_f_pointer(derivedArray, myF90DerivedArray, shapeArray)
 
-print *, myF90DerivedArray(1)
-!end
     ! upper bound of each dim is arrayLen2
-!    shapeArray2(1) = dim1
-!    shapeArray2(2) = dim2
-!    call c_f_pointer(derived2DArray, derivedArray2D, shapeArray2)
-!print *, derivedArray2D(dim1, dim2)%cInt
-!print *, derivedArray2D(dim1, dim2)%cDouble
-!print *, derivedArray2D(dim1, dim2)%cFloat
-!print *, derivedArray2D(dim1, dim2)%cShort
+    shapeArray2(1) = dim1
+    shapeArray2(2) = dim2
+    call c_f_pointer(derived2DArray, derivedArray2D, shapeArray2)
     ! make sure the last element is ok
-!    if((derivedArray2D(dim1, dim2)%cInt .ne. 4) .or. &
-!         (derivedArray2D(dim1, dim2)%cDouble .ne. 4.0d0) .or. &
-!         (derivedArray2D(dim1, dim2)%cFloat .ne. 4.0) .or. &
-!         (derivedArray2D(dim1, dim2)%cShort .ne. 4)) then
-!       call abort()
-!    endif
+    if((derivedArray2D(dim1, dim2)%cInt .ne. 4) .or. &
+         (derivedArray2D(dim1, dim2)%cDouble .ne. 4.0d0) .or. &
+         (derivedArray2D(dim1, dim2)%cFloat .ne. 4.0) .or. &
+         (derivedArray2D(dim1, dim2)%cShort .ne. 4)) then
+       call abort()
+    endif
   end subroutine testDerivedPtrs
 end module c_f_pointer_tests