[PATCH] Fix failing ubsan/pr80932.c test
Marek Polacek
polacek@redhat.com
Thu Jun 8 12:27:00 GMT 2017
This test was failing e.g. on x86_64 with -m32. Instead of limiting to
arches where long is 64-bit, I converted the test to use ints, which still
demonstrates the same bug in folding, but should now pass everywhere.
Tested on x86_64-linux, applying to trunk.
2017-06-08 Marek Polacek <polacek@redhat.com>
PR sanitize/80932
* c-c++-common/ubsan/pr80932.c: Test with ints, not with long ints.
diff --git gcc/testsuite/c-c++-common/ubsan/pr80932.c gcc/testsuite/c-c++-common/ubsan/pr80932.c
index a833712..92903f7 100644
--- gcc/testsuite/c-c++-common/ubsan/pr80932.c
+++ gcc/testsuite/c-c++-common/ubsan/pr80932.c
@@ -4,10 +4,10 @@
int x = 1;
-long int
+int
foo (void)
{
- return ((long) (13801962912760474560ULL * x) - (long) (15334142073106273231ULL * x)) * -6;
+ return ((int) (2855545792U * x) - (int) (3269399503U * x)) * -5;
}
int
Marek
More information about the Gcc-patches
mailing list