[tree-ssa] Fix typo -- GMP failure
law@redhat.com
law@redhat.com
Fri Mar 19 22:42:00 GMT 2004
Sigh. A simple typo (GT_EXPR when I meant LT_EXPR) was causing us to
incorrectly transform an ABS_EXPR expression. This only happened
in rare cases because the typo was in the code to initialize COND_EXPR
for the first time. Subsequent uses all DTRT. Sigh.
Anyway the GMP testsuite tripped on this one. I've extracted a nice simple
testcase for our testsuite.
Bootstrapped and regression tested i686-pc-linux-gnu.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Fix typo.
Eliminate unnecessary test of VAL.
* gcc.c-torture/execute/20040319-1.c: New test.
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.148
diff -c -p -r1.1.2.148 tree-ssa-dom.c
*** tree-ssa-dom.c 16 Mar 2004 22:31:55 -0000 1.1.2.148
--- tree-ssa-dom.c 19 Mar 2004 21:16:01 -0000
*************** simplify_rhs_and_lookup_avail_expr (stru
*** 1794,1800 ****
if (! dummy_cond)
{
! dummy_cond = build (GT_EXPR, boolean_type_node,
op, integer_zero_node);
dummy_cond = build (COND_EXPR, void_type_node,
dummy_cond, NULL, NULL);
--- 1794,1800 ----
if (! dummy_cond)
{
! dummy_cond = build (LT_EXPR, boolean_type_node,
op, integer_zero_node);
dummy_cond = build (COND_EXPR, void_type_node,
dummy_cond, NULL, NULL);
*************** simplify_rhs_and_lookup_avail_expr (stru
*** 1817,1823 ****
{
tree t;
! if (val && integer_onep (val))
t = build1 (NEGATE_EXPR, TREE_TYPE (op), op);
else
t = op;
--- 1817,1823 ----
{
tree t;
! if (integer_onep (val))
t = build1 (NEGATE_EXPR, TREE_TYPE (op), op);
else
t = op;
Index: testsuite/gcc.c-torture/execute/20040319-1.c
===================================================================
RCS file: testsuite/gcc.c-torture/execute/20040319-1.c
diff -N testsuite/gcc.c-torture/execute/20040319-1.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.c-torture/execute/20040319-1.c 19 Mar 2004 21:16:56 -0000
***************
*** 0 ****
--- 1,17 ----
+ int
+ blah (int zzz)
+ {
+ int foo;
+ if (zzz >= 0)
+ return 1;
+ foo = (zzz >= 0 ? (zzz) : -(zzz));
+ return foo;
+ }
+
+ main()
+ {
+ if (blah (-1) != 1)
+ abort ();
+ else
+ exit (0);
+ }
More information about the Gcc-patches
mailing list