--- /dev/null
+Index: fold-const.c
+===================================================================
+*** gcc4.0.3/gcc/fold-const.c (revision 114755)
+--- gcc4.0.3/fold-const.c (working copy)
+*************** operand_equal_p (tree arg0, tree arg1, u
+*** 2497,2502 ****
+--- 2497,2507 ----
+ if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)))
+ return 0;
+
++ /* If both types don't have the same precision, then it is not safe
++ to strip NOPs. */
++ if (TYPE_PRECISION (TREE_TYPE (arg0)) != TYPE_PRECISION (TREE_TYPE (arg1)))
++ return 0;
++
+ STRIP_NOPS (arg0);
+ STRIP_NOPS (arg1);
+
+
+
+/* { dg-do run } */
+
+extern void abort(void);
+struct a
+{
+ unsigned int bits : 1;
+ signed long val : ((sizeof(long) * 8) - 1);
+};
+int Fnegate (struct a b)
+{
+ if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
+ && (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
+ return 0 ;
+ abort ();
+}
+int main ()
+{
+ struct a b = {1, 1};
+ Fnegate (b);
+ return 0;
+}