This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.0 patch]: Backport PR/24901 - fix "fold" checking LP64 alignment
- From: "Kaveh R. Ghazi" <ghazi at caipclassic dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Sun, 12 Feb 2006 08:27:05 -0500 (EST)
- Subject: [4.0 patch]: Backport PR/24901 - fix "fold" checking LP64 alignment
This patch backports to 4.0 the equivalent of this one:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00902.html
It cures alignment issues with "fold" checking on sparc64 et al.
Currently a "fold" checking bootstrap on sparc64 dies with a bus error
in stage1 when we start to build target files.
This fix is already installed on mainline/4.1 and is only activated
when "fold" checking is turned on. Therefore it is safe for a release
branch.
Tested via bootstrap/regtest with gcc-4.0 on sparc64-sun-solaris2.10
using --enable-checking=yes,rtl,fold.
Okay for 4.0? (Approval of this blocks a similar patch approved for 3.4)
Thanks,
--Kaveh
2006-02-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Backport:
2006-02-01 Steve Ellcey <sje@cup.hp.com>
PR middle-end/24901
* fold-const.c (fold_checksum_tree): Change type of buf.
diff -rup orig/egcc-4.0-SVN20060203/gcc/fold-const.c egcc-4.0-SVN20060203/gcc/fold-const.c
--- orig/egcc-4.0-SVN20060203/gcc/fold-const.c 2006-01-23 00:22:49.000000000 -0500
+++ egcc-4.0-SVN20060203/gcc/fold-const.c 2006-02-03 10:01:08.549578339 -0500
@@ -9955,7 +9955,7 @@ fold_checksum_tree (tree expr, struct md
{
void **slot;
enum tree_code code;
- char buf[sizeof (struct tree_decl)];
+ struct tree_decl buf;
int i, len;
recursive_label:
@@ -9974,8 +9974,8 @@ recursive_label:
&& DECL_ASSEMBLER_NAME_SET_P (expr))
{
/* Allow DECL_ASSEMBLER_NAME to be modified. */
- memcpy (buf, expr, tree_size (expr));
- expr = (tree) buf;
+ memcpy (&buf, expr, tree_size (expr));
+ expr = (tree) &buf;
SET_DECL_ASSEMBLER_NAME (expr, NULL);
}
else if (TREE_CODE_CLASS (code) == tcc_type
@@ -9984,8 +9984,8 @@ recursive_label:
|| TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr)))
{
/* Allow these fields to be modified. */
- memcpy (buf, expr, tree_size (expr));
- expr = (tree) buf;
+ memcpy (&buf, expr, tree_size (expr));
+ expr = (tree) &buf;
TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr) = 0;
TYPE_POINTER_TO (expr) = NULL;
TYPE_REFERENCE_TO (expr) = NULL;