aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlga Golovanevsky <olga@gcc.gnu.org>2008-01-25 07:47:46 +0000
committerOlga Golovanevsky <olga@gcc.gnu.org>2008-01-25 07:47:46 +0000
commitbd91d74392900e18b3eb5c06ddd39cd06977890a (patch)
treed3c9cde07c40b673e814d8f4f23f375584e48be9
parent6ba2cd59597e9366f6b47a75cf1bac1e1e1cd8c5 (diff)
downloadgcc-bd91d74392900e18b3eb5c06ddd39cd06977890a.zip
gcc-bd91d74392900e18b3eb5c06ddd39cd06977890a.tar.gz
gcc-bd91d74392900e18b3eb5c06ddd39cd06977890a.tar.bz2
[multiple changes]
2008-01-25 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-24 Olga Golovanevsky <olga@il.ibm.com> * gcc.dg/struct/wo_prof_malloc_size_var.c: UnXFAIL. From-SVN: r131817
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-struct-reorg.c19
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c3
4 files changed, 24 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f24d973..cf427b4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-25 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-25 Ben Elliston <bje@au.ibm.com>
PR other/22232
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 04948a3..9786db4 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -1251,12 +1251,15 @@ create_new_stmts_for_cond_expr (tree stmt)
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 +2391,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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8af0ba2..8705d66 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-01-25 Olga Golovanevsky <olga@il.ibm.com>
+
+ * gcc.dg/struct/wo_prof_malloc_size_var.c: UnXFAIL.
+
2008-01-24 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34202
diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c b/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
index b1614c0..32842b0a 100644
--- a/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
+++ b/gcc/testsuite/gcc.dg/struct/wo_prof_malloc_size_var.c
@@ -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 "*" } } */