This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Jan 2011 11:55:18 +0000
- Subject: [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
- Auto-submitted: auto-generated
- References: <bug-47538-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538
--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 11:55:03 UTC ---
Can we use sth like
Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c (revision 169434)
+++ tree-ssa-ccp.c (working copy)
@@ -1770,9 +1770,38 @@ bit_value_binop_1 (enum tree_code code,
{
bool uns = (TREE_CODE (r1type) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type));
+
/* Assume we'll get a constant result. Use an initial varying value,
we fall back to varying in the end if necessary. */
*mask = double_int_minus_one;
+
+ /* We have some sizetype issues, drop to varying in case there are
+ mismatches. */
+ switch (code)
+ {
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
+ case LROTATE_EXPR:
+ case RROTATE_EXPR:
+ if ((TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type) ? 0 : TYPE_UNSIGNED (type)) != uns)
+ return;
+ break;
+
+ case EQ_EXPR:
+ case NE_EXPR:
+ case LT_EXPR:
+ case LE_EXPR:
+ case GE_EXPR:
+ case GT_EXPR:
+ if ((TREE_CODE (r2type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (r2type) ? 0 : TYPE_UNSIGNED (r2type)) != uns)
+ return;
+ break;
+
+ default:;
+ }
+
instead? It makes it more obvious what happens (IMHO).