Port from no-undefined-overflow branch
2009-03-09 Richard Guenther <rguenther@suse.de>
* fold-const.c (add_double_with_sign): Fix unsigned overflow
detection.
* gcc.c-torture/execute/pr42721.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155887
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/42721
+ Port from no-undefined-overflow branch
+ 2009-03-09 Richard Guenther <rguenther@suse.de>
+
+ * fold-const.c (add_double_with_sign): Fix unsigned overflow
+ detection.
+
2010-01-14 Richard Guenther <rguenther@suse.de>
PR lto/42665
HOST_WIDE_INT h;
l = l1 + l2;
- h = h1 + h2 + (l < l1);
+ h = (HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) h1
+ + (unsigned HOST_WIDE_INT) h2
+ + (l < l1));
*lv = l;
*hv = h;
if (unsigned_p)
- return (unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1;
+ return ((unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1
+ || (h == h1
+ && l < l1));
else
return OVERFLOW_SUM_SIGN (h1, h2, h);
}
+2010-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/42721
+ * gcc.c-torture/execute/pr42721.c: New test.
+
2010-01-14 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/42709
--- /dev/null
+/* PR c/42721 */
+
+extern void abort (void);
+
+static unsigned long long
+foo (unsigned long long x, unsigned long long y)
+{
+ return x / y;
+}
+
+static int a, b;
+
+int
+main (void)
+{
+ unsigned long long c = 1;
+ b ^= c && (foo (a, -1ULL) != 1L);
+ if (b != 1)
+ abort ();
+ return 0;
+}