aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2006-10-30 08:15:09 -0800
committerAndrew Pinski <pinskia@gcc.gnu.org>2006-10-30 08:15:09 -0800
commit0e697399655c6ae1a53267d3d38e462b8848910e (patch)
treea627b06af6dec5b97093fe2b8d55d7d273615ce4
parentff84991f990cfd20fd24331701912f78427f83ae (diff)
downloadgcc-0e697399655c6ae1a53267d3d38e462b8848910e.zip
gcc-0e697399655c6ae1a53267d3d38e462b8848910e.tar.gz
gcc-0e697399655c6ae1a53267d3d38e462b8848910e.tar.bz2
re PR fortran/29410 ([4.2 only] bug with TRANSFER() and -O2)
2006-10-30 Andrew Pinski <pinskia@gmail.com> PR fortran/29410 * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): Change over to create VIEW_CONVERT_EXPR instead of using an ADDR_EXPR, a cast and then an indirect reference 2006-10-30 Andrew Pinski <pinskia@gmail.com> PR Fortran/29410 * gfortran.fortran-torture/execute/transfer1.f90: New test. From-SVN: r118186
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-intrinsic.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/transfer1.f9010
4 files changed, 26 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b015e78..25ace32 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-30 Andrew Pinski <pinskia@gmail.com>
+
+ PR fortran/29410
+ * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer):
+ Change over to create VIEW_CONVERT_EXPR instead of using an
+ ADDR_EXPR, a cast and then an indirect reference
+
2006-10-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* trans-intrinsic.c (gfc_conv_intrinsic_loc): Make LOC return a
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 911782b..44d439d 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -2914,7 +2914,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
/* Scalar transfer statement.
- TRANSFER (source, mold) = *(typeof<mold> *)&source. */
+ TRANSFER (source, mold) = VIEW_CONVERT_EXPR<typeof<mold> >source. */
static void
gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
@@ -2939,9 +2939,9 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
arg = arg->next;
type = gfc_typenode_for_spec (&expr->ts);
- ptr = convert (build_pointer_type (type), ptr);
if (expr->ts.type == BT_CHARACTER)
{
+ ptr = convert (build_pointer_type (type), ptr);
gfc_init_se (&argse, NULL);
gfc_conv_expr (&argse, arg->expr);
gfc_add_block_to_block (&se->pre, &argse.pre);
@@ -2951,7 +2951,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
}
else
{
- se->expr = build_fold_indirect_ref (ptr);
+ tree tmp = build_fold_indirect_ref (ptr);
+ se->expr = fold_build1 (VIEW_CONVERT_EXPR, type, tmp);
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f7182e4..f8876e3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-30 Andrew Pinski <pinskia@gmail.com>
+
+ PR Fortran/29410
+ * gfortran.fortran-torture/execute/transfer1.f90: New test.
+
2006-10-30 Joseph Myers <joseph@codesourcery.com>
* lib/target-supports.exp (check_function_available): Declare
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/transfer1.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/transfer1.f90
new file mode 100644
index 0000000..855fe9d
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/transfer1.f90
@@ -0,0 +1,10 @@
+program chop
+ integer ix, iy
+ real x, y
+ x = 1.
+ y = x
+ ix = transfer(x,ix)
+ iy = transfer(y,iy)
+ print '(2z20.8)', ix, iy
+ if (ix /= iy) call abort
+end program chop