This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix failing ubsan/pr80932.c test
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 8 Jun 2017 14:27:25 +0200
- Subject: [PATCH] Fix failing ubsan/pr80932.c test
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6B18F8BA01
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B18F8BA01
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