This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] machine dependent constant in tree-ssa-structalias.c
- From: Alessandro dot Lonardo at roma1 dot infn dot it
- To: gcc-patches at gcc dot gnu dot org
- Cc: laura dot tosoratto at roma1 dot infn dot it
- Date: Tue, 17 Oct 2006 16:57:18 +0200 (CEST)
- Subject: [PATCH] machine dependent constant in tree-ssa-structalias.c
The following code produced an undefined result on the apeNEXT
architecture (BITS_PER_UNIT=64).
typedef struct {
int a, b, c;
} S;
int result[3];
int main() {
S x;
x.a = 0x78;
x.b = 0x79;
x.c = 0x80;
result[0] = x.a;
result[1] = x.b;
result[2] = x.c;
return result[2];
}
The patch is obvious, could somebody commit it?
Alessandro Lonardo
===================================================================
--- tree-ssa-structalias.c (revision 117826)
+++ tree-ssa-structalias.c (working copy)
@@ -2309,7 +2309,7 @@
|| TREE_CODE (DECL_FIELD_BIT_OFFSET (fdecl)) != INTEGER_CST)
return -1;
- return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8)
+ return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * BITS_PER_UNIT)
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
}