This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Commit a workaround for PR 29516
- From: "François-Xavier Coudert" <fxcoudert at gmail dot com>
- To: GFortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 9 Jan 2007 14:01:59 +0100
- Subject: [gfortran] Commit a workaround for PR 29516
Hi all,
I intend to commit the following workaround for PR 29516
(trans-array.c getting miscompiled on i686-darwin) to mainline and
4.2, unless someone objects.
Of course, we'd better have someone fix the original bug, but it
doesn't look like it's going to happen soon :)
Bootstrapped and regtested on i686-linux. It does clear the testsuite
for i686-darwin.
FX
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c (revision 120585)
+++ gcc/fortran/trans-array.c (working copy)
@@ -798,7 +798,10 @@
dest_info->dim[n] = n;
dest_index = gfc_rank_cst[n];
- src_index = gfc_rank_cst[1 - n];
+ /* The following line of code is a workaround for PR 29516,
+ to allow this not to miscompile on i386-darwin.
+ The original code was: src_index = gfc_rank_cst[1 - n]; */
+ src_index = gfc_rank_cst[(n == 0) ? 1 : 0];
gfc_add_modify_expr (&se->pre,
gfc_conv_descriptor_stride (dest, dest_index),