This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34701] ICE in tree-ssa-ccp.c with -fipa-struct-reorg
- From: "alond at il dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jan 2008 13:01:40 -0000
- Subject: [Bug middle-end/34701] ICE in tree-ssa-ccp.c with -fipa-struct-reorg
- References: <bug-34701-15577@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from alond at il dot ibm dot com 2008-01-07 13:01 -------
I have tested the following patch. It fixes the problem. All struct-reorg tests
has also passed on my machine.
It looks like the input to malloc was not calculated correctly in case the size
of the structure is not the order of 2.
Index: ipa-struct-reorg.c
===================================================================
--- ipa-struct-reorg.c (revision 131371)
+++ ipa-struct-reorg.c (working copy)
@@ -623,7 +623,12 @@
add_referenced_var (*res);
if (exact_log2 (struct_size_int) == -1)
- new_stmt = build_gimple_modify_stmt (num, struct_size);
+ {
+ tree size = build_int_cst (TREE_TYPE (num), struct_size_int);
+ new_stmt = build_gimple_modify_stmt (*res, build2 (MULT_EXPR,
+ TREE_TYPE (num),
+ num, size));
+ }
else
{
tree C = build_int_cst (TREE_TYPE (num), exact_log2 (struct_size_int));
Ok to submit this patch?
Alon
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34701