diff mbox

Fix failing ubsan/pr80932.c test

Message ID 20170608122725.GT3413@redhat.com
State New
Headers show

Commit Message

Marek Polacek June 8, 2017, 12:27 p.m. UTC
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.


	Marek
diff mbox

Patch

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