This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/32100] [4.2/4.3 Regression] vrp bitfield miscompilation
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 May 2007 21:51:10 -0000
- Subject: [Bug tree-optimization/32100] [4.2/4.3 Regression] vrp bitfield miscompilation
- References: <bug-32100-7958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pinskia at gcc dot gnu dot org 2007-05-26 21:51 -------
The fix:
Index: fold-const.c
===================================================================
--- fold-const.c (revision 125044)
+++ fold-const.c (working copy)
@@ -13485,9 +13485,14 @@ tree_expr_nonnegative_warnv_p (tree t, b
/* ... fall through ... */
default:
- if (truth_value_p (TREE_CODE (t)))
- /* Truth values evaluate to 0 or 1, which is nonnegative. */
- return true;
+ {
+ tree type = TREE_TYPE (t);
+ if ((TYPE_PRECISION (t) != 1 || TYPE_UNSIGNED (t))
+ &&truth_value_p (TREE_CODE (t)))
+ /* Truth values evaluate to 0 or 1, which is nonnegative unless we
+ have a signed:1 type (where the value is -1 and 0). */
+ return true;
+ }
}
/* We don't know sign of `t', so be conservative and return false. */
The problem is that tree_expr_nonnegative_warnv_p is returning true for EQ_EXPR
where the type is signed:1 where obvious the value is going to be -1/0 and not
0/1.
Mine.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32100