* [PATCH] Fix failing ubsan/pr80932.c test
@ 2017-06-08 12:27 Marek Polacek
0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2017-06-08 12:27 UTC (permalink / raw)
To: GCC Patches
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-08 12:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08 12:27 [PATCH] Fix failing ubsan/pr80932.c test Marek Polacek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).