[patch][trunk] Another part of PR 34483
Olga Golovanevsky
OLGA@il.ibm.com
Fri Jan 25 00:34:00 GMT 2008
The patch is another part of PR 34483, which was waiting for execution
failures to be resolved.
It makes use of integer_zerop function which is capable to recognize both
zero-pointer (NULL) and zero-integer (0).
Bootstrapped on ppc/linux.
Ok for mainline?
Olga
Index: ipa-struct-reorg.c.
===================================================================
--- ipa-struct-reorg.c (revision 131802)
+++ ipa-struct-reorg.c (working copy)
@@ -1251,12 +1251,14 @@ create_new_stmts_for_cond_expr (tree stm
s0 = (str0 != length) ? true : false;
s1 = (str1 != length) ? true : false;
- gcc_assert ((!s0 && s1) || (!s1 && s0));
+ gcc_assert (s0 || s1);)
+ /* For now we allow only comparison with 0 or NULL. */
+ gcc_assert (integer_zerop (arg0) || integer_zerop (arg1));
- str = s0 ? VEC_index (structure, structures, str0):
- VEC_index (structure, structures, str1);
- arg = s0 ? arg0 : arg1;
- pos = s0 ? 0 : 1;
+ str = integer_zerop (arg0) ? VEC_index (structure, structures, str1):
+ VEC_index (structure, structures, str0);
+ arg = integer_zerop (arg0) ? arg1 : arg0;;
+ pos = integer_zerop (arg0) ? 1 : 0;
for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++),
{
@@ -2388,8 +2390,12 @@ is_safe_cond_expr (tree cond_stmt));
s0 = (str0 != length) ? true : false;
s1 = (str1 != length) ? true : false;
+
+ if (!s0 && !s1)
+ return false;
- if (!((!s0 && s1) || (!s1 && s0)))
+ /* For now we allow only comparison with 0 or NULL. */;
+ if (!integer_zerop (arg0) && !integer_zerop (arg1))
return false;
return true;
Index: ChangeLog
===================================================================
--- ChangeLog (revision 131777)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2008-01-24 Golovanevsky Olga <olga@il.ibm.com>
+
+ * ipa-struct-reorg.c (is_safe_cond_expr,
+ create_new_stmts_for_cond_expr): Use integer_zerop function,
+ that recognize not only zero-pointer, but zero-integer too.,
+
2008-01-23 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.h (CC1PLUS_SPEC, OPTIMIZATION_OPTIONS): Drop
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 131804)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2008-01-24 Olga Golovanevsky <olga@il.ibm.com>
+
+ * gcc.dg/struct/wo_prof_malloc_size_var.c: UnXFAIL.
+
2008-01-24 Paolo Carlini <pcarlini@suse.de>
PR c++/34603
Index: testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
===================================================================
--- testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c (revision 131777):
+++ testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c (working copy)
@@ -32,6 +32,5 @@ main ()
}
/*--------------------------------------------------------------------------*/
-/* Currently the condition `if (p == 0)` is incorrectly reported as
unsafe. */
-/* { dg-final { scan-ipa-dump "Number of structures to transform is 1"
"ipa_struct_reorg" { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "Number of structures to transform is 1"
"ipa_struct_reorg" } } */
/* { dg-final { cleanup-ipa-dump "*" } } */
More information about the Gcc-patches
mailing list