This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix for PR35041


This patch fixes PR 35041.

Bootstrapped on powerpc-suse-linux. All struct-reorg tests passed
successfully.

OK for mainline?

Alon.

Index: ChangeLog
===================================================================
--- ChangeLog     (revision 131977)
+++ ChangeLog     (working copy)
@@ -1,3 +1,9 @@
+2008-01-31  Alon Dayan  <alond@il.ibm.com>
+
+     PR tree-optimization/35041
+     * ipa-struct-reorg.c (find_pos_in_stmt_1): Add another option
+     to locate the right position in a statement.
+
 2008-01-31  Richard Sandiford  <rsandifo@nildram.co.uk>

      PR rtl-optimization/34995
Index: testsuite/gcc.dg/struct/wo_prof_double_malloc.c
===================================================================
--- testsuite/gcc.dg/struct/wo_prof_double_malloc.c   (revision 0)
+++ testsuite/gcc.dg/struct/wo_prof_double_malloc.c   (revision 0)
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-do run } */}
+
+#include <stdlib.h>}
+
+typedef struct test_struct
+{
+  int a;
+  int b;
+} type_struct;
+}
+typedef type_struct **struct_pointer2;
+
+struct_pointer2 str1;
+
+int main()
+{
+  int i, j;
+
+  str1 = malloc (2 * sizeof (type_struct*));
+
+  for (i=0; i<=1; i++)
+    str1[i] = malloc (2 * sizeof (type_struct));.
+
+  return 0;
+}
+}
+/*--------------------------------------------------------------------------*/
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1"
"ipa_struct_reorg" } } */
+/* { dg-final { cleanup-ipa-dump "*" } } */
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 131977)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2008-01-31  Alon Dayan  <alond@il.ibm.com>
+
+     PR tree-optimization/35041
+     * gcc.dg/struct/wo_prof_double_malloc.c: New test.
+
 2008-01-30  Jan Hubicka  <jh@suse.cz>

      * gcc.c-torture/execute/pr34982.c: Add forgotten return 0.
Index: ipa-struct-reorg.c
===================================================================
--- ipa-struct-reorg.c  (revision 131977)
+++ ipa-struct-reorg.c  (working copy)
@@ -887,7 +887,9 @@
   tree ref = r_pos->ref;
   tree t = *tp;

-  if (t == ref)
+  if (t == ref ||
+      (TREE_CODE (t) == SSA_NAME
+       && SSA_NAME_VAR (t) == ref)))
     {
       r_pos->pos = tp;
       return t;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]