summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr69399.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-01-21 11:51:47 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-01-22 10:49:32 -0800
commit8dcdab63ef8df5c9f2739383686bc7eedcb303e5 (patch)
tree93cd493e747cc68df8837868faa04024a040335b /gcc/testsuite/gcc.dg/torture/pr69399.c
parent64c6e7a35bf51c2794a8cfd9f6c0f5b92929c0f7 (diff)
downloadgcc-hjl/pr69399/gcc-5-branch.tar.gz
Add HAVE_WORKING_CXX_BUILTIN_CONSTANT_Phjl/pr69399/gcc-5-branch
Without the fix for PR 65656, g++ miscompiles __builtin_constant_p in wi::lrshift in wide-int.h. Add a check with PR 65656 testcase to verify that C++ __builtin_constant_p works properly. gcc/ PR c++/69399 * configure.ac: Check if C++ __builtin_constant_p works properly. (HAVE_WORKING_CXX_BUILTIN_CONSTANT_P): AC_DEFINE. * system.h (STATIC_CONSTANT_P): Use __builtin_constant_p only if HAVE_WORKING_CXX_BUILTIN_CONSTANT_P is defined. * config.in: Regenerated. * configure: Likewise. gcc/testsuite/ PR c++/69399 * gcc.dg/torture/pr69399.c: New test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr69399.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69399.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr69399.c b/gcc/testsuite/gcc.dg/torture/pr69399.c
new file mode 100644
index 00000000000..3e171695c52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69399.c
@@ -0,0 +1,21 @@
+/* { dg-do run { target int128 } } */
+
+typedef __UINT64_TYPE__ u64;
+typedef unsigned __int128 u128;
+
+static unsigned __attribute__((noinline, noclone))
+foo(u64 u)
+{
+ u128 v = u | 0xffffff81;
+ v >>= 64;
+ return v;
+}
+
+int
+main()
+{
+ unsigned x = foo(27);
+ if (x != 0)
+ __builtin_abort();
+ return 0;
+}