aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-10-17 12:50:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-10-17 12:50:16 +0200
commit4eb4a256cd4a39555f4d834c47cabc2e136ed02a (patch)
tree57d50dcdf67827495420438304dc1e393caa452f /gcc/testsuite
parent9d4ded759a1367ebe6588be36d0ea1410e24e3ca (diff)
downloadgcc-4eb4a256cd4a39555f4d834c47cabc2e136ed02a.zip
gcc-4eb4a256cd4a39555f4d834c47cabc2e136ed02a.tar.gz
gcc-4eb4a256cd4a39555f4d834c47cabc2e136ed02a.tar.bz2
re PR tree-optimization/63302 (Code with 64-bit long long constants is miscompiled on 32-bit host)
PR tree-optimization/63302 * tree-ssa-reassoc.c (optimize_range_tests_xor, optimize_range_tests_diff): Use !integer_pow2p () instead of tree_log2 () < 0. * gcc.c-torture/execute/pr63302.c: New test. From-SVN: r216391
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr63302.c60
2 files changed, 65 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 218cb56..0cc6221 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/63302
+ * gcc.c-torture/execute/pr63302.c: New test.
+
2014-10-17 Tom de Vries <tom@codesourcery.com>
PR rtl-optimization/61605
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr63302.c b/gcc/testsuite/gcc.c-torture/execute/pr63302.c
new file mode 100644
index 0000000..9967024
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr63302.c
@@ -0,0 +1,60 @@
+/* PR tree-optimization/63302 */
+
+#ifdef __SIZEOF_INT128__
+#if __SIZEOF_INT128__ * __CHAR_BIT__ == 128
+#define USE_INT128
+#endif
+#endif
+#if __SIZEOF_LONG_LONG__ * __CHAR_BIT__ == 64
+#define USE_LLONG
+#endif
+
+#ifdef USE_INT128
+__attribute__((noinline, noclone)) int
+foo (__int128 x)
+{
+ __int128 v = x & (((__int128) -1 << 63) | 0x7ff);
+
+ return v == 0 || v == ((__int128) -1 << 63);
+}
+#endif
+
+#ifdef USE_LLONG
+__attribute__((noinline, noclone)) int
+bar (long long x)
+{
+ long long v = x & (((long long) -1 << 31) | 0x7ff);
+
+ return v == 0 || v == ((long long) -1 << 31);
+}
+#endif
+
+int
+main ()
+{
+#ifdef USE_INT128
+ if (foo (0) != 1
+ || foo (1) != 0
+ || foo (0x800) != 1
+ || foo (0x801) != 0
+ || foo ((__int128) 1 << 63) != 0
+ || foo ((__int128) -1 << 63) != 1
+ || foo (((__int128) -1 << 63) | 1) != 0
+ || foo (((__int128) -1 << 63) | 0x800) != 1
+ || foo (((__int128) -1 << 63) | 0x801) != 0)
+ __builtin_abort ();
+#endif
+#ifdef USE_LLONG
+ if (bar (0) != 1
+ || bar (1) != 0
+ || bar (0x800) != 1
+ || bar (0x801) != 0
+ || bar (1LL << 31) != 0
+ || bar (-1LL << 31) != 1
+ || bar ((-1LL << 31) | 1) != 0
+ || bar ((-1LL << 31) | 0x800) != 1
+ || bar ((-1LL << 31) | 0x801) != 0)
+ __builtin_abort ();
+#endif
+ return 0;
+}