On 03/12/2012 01:50 PM, Tobias Burnus wrote:
Additionally, I modified some tree-dump patterns for the extent and
for the base_addr change.
Three more changes: The libgfortran change should have been just a
cleanup, but it seems to also fix a failure. Plus two dump changes. The
number of failures is now down to 160 FAIL lines - or to the following
18 test cases (plus three which fail also on the trunk):
gfortran.dg/c_f_pointer_complex.f03
gfortran.dg/c_f_pointer_shape_tests_2.f03
gfortran.dg/c_f_pointer_shape_tests_4.f03
gfortran.dg/c_f_pointer_tests.f90
gfortran.dg/c_f_pointer_tests_4.f90
gfortran.dg/optional_dim_3.f90
gfortran.dg/associated_2.f90
gfortran.dg/auto_char_dummy_array_1.f90
gfortran.dg/class_array_1.f03
gfortran.dg/auto_char_len_3.f90
gfortran.dg/class_array_1.f03
gfortran.dg/class_array_2.f03
gfortran.dg/class_array_3.f03
gfortran.dg/class_to_type_1.f03
gfortran.dg/proc_decl_23.f90
gfortran.dg/read_eof_all.f90
gfortran.dg/transfer_intrinsic_3.f90
gfortran.dg/subref_array_pointer_2.f90
The array c_f_pointer function fails because the fptr's size is not set
(it is needed to set the sm). Solution: Handle everything in the FE.
Tobias
Index: libgfortran/ChangeLog.fortran-dev
===================================================================
--- libgfortran/ChangeLog.fortran-dev (revision 185216)
+++ libgfortran/ChangeLog.fortran-dev (working copy)
@@ -1,5 +1,9 @@
2012-03-12 Tobias Burnus <bur...@net-b.de>
+ * intrinsics/spread_generic.c (spread_internal): Properly use "sm".
+
+2012-03-12 Tobias Burnus <bur...@net-b.de>
+
* intrinsics/iso_c_binding.c (c_f_pointer_u0): Use
GFC_DESCRIPTOR_SM instead of GFC_DESCRIPTOR_STRIDE_BYTES.
Index: libgfortran/intrinsics/spread_generic.c
===================================================================
--- libgfortran/intrinsics/spread_generic.c (revision 185199)
+++ libgfortran/intrinsics/spread_generic.c (working copy)
@@ -71,18 +71,18 @@ spread_internal (gfc_array_char *ret, const gfc_ar
/* The front end has signalled that we need to populate the
return array descriptor. */
- size_t ub, stride;
+ size_t ext, sm;
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank;
dim = 0;
- rs = 1;
+ rs = size;
for (n = 0; n < rrank; n++)
{
- stride = rs;
+ sm = rs;
if (n == *along - 1)
{
- ub = ncopies - 1;
- rdelta = rs * size;
+ ext = ncopies;
+ rdelta = rs;
rs *= ncopies;
}
else
@@ -90,17 +90,17 @@ spread_internal (gfc_array_char *ret, const gfc_ar
count[dim] = 0;
extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
sstride[dim] = GFC_DESCRIPTOR_SM(source,dim);
- rstride[dim] = rs * size;
+ rstride[dim] = rs;
- ub = extent[dim]-1;
+ ext = extent[dim];
rs *= extent[dim];
dim++;
}
- GFC_DIMENSION_SET (ret->dim[n], 0, ub, stride*size);
+ GFC_DIMENSION_SET (ret->dim[n], 0, ext, sm);
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs * size);
+ ret->base_addr = internal_malloc_size (rs);
if (rs <= 0)
return;
Index: gcc/testsuite/gfortran.dg/internal_pack_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/internal_pack_4.f90 (revision 185197)
+++ gcc/testsuite/gfortran.dg/internal_pack_4.f90 (working copy)
@@ -26,7 +26,7 @@ USE M1
CALL S2()
END
-! { dg-final { scan-tree-dump-times "a != 0B \\? \\\(.*\\\) _gfortran_internal_pack" 1 "original" } }
-! { dg-final { scan-tree-dump-times "if \\(a != 0B &&" 1 "original" } }
+! { dg-final { scan-tree-dump-times " a != 0B && \\(real\\(kind=.\\).0:. . restrict\\) a->base_addr != 0B \\? \\\(.*\\\) _gfortran_internal_pack" 1 "original" } }
+! { dg-final { scan-tree-dump-times "if \\(\\(a != 0B && \\(real\\(kind=.\\).0:. . restrict\\) a->base_addr != 0B\\) &&" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-final { cleanup-modules "m1" } }
Index: gcc/testsuite/gfortran.dg/assign_10.f90
===================================================================
--- gcc/testsuite/gfortran.dg/assign_10.f90 (revision 185197)
+++ gcc/testsuite/gfortran.dg/assign_10.f90 (working copy)
@@ -23,6 +23,6 @@ end
! cases will all yield a temporary, so that atmp appears 18 times.
! Note that it is the kind conversion that generates the temp.
!
-! { dg-final { scan-tree-dump-times "parm" 18 "original" } }
-! { dg-final { scan-tree-dump-times "atmp" 18 "original" } }
+! { dg-final { scan-tree-dump-times "parm" 20 "original" } }
+! { dg-final { scan-tree-dump-times "atmp" 20 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
Index: gcc/testsuite/ChangeLog.fortran-dev
===================================================================
--- gcc/testsuite/ChangeLog.fortran-dev (revision 185225)
+++ gcc/testsuite/ChangeLog.fortran-dev (working copy)
@@ -1,5 +1,10 @@
2012-03-12 Tobias Burnus <bur...@net-b.de>
+ * gfortran.dg/assign_10.f90: Update scan-tree-dump-times.
+ * gfortran.dg/internal_pack_4.f90: Ditto.
+
+2012-03-12 Tobias Burnus <bur...@net-b.de>
+
* assumed_type_2.f90: Change "data" to "base_addr" in
scan-tree-dump.
* block_2.f08: Ditto.