20141107-1.c: New testcase.
authorAndrew Pinski <apinski@cavium.com>
Fri, 7 Nov 2014 23:08:43 +0000 (23:08 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 7 Nov 2014 23:08:43 +0000 (15:08 -0800)
2014-11-07  Andrew Pinski  <apinski@cavium.com>

* gcc.c-torture/execute/20141107-1.c: New testcase.

From-SVN: r217242

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20141107-1.c [new file with mode: 0644]

index ba9df2cfb2875f414729988fec3024b285a40c02..1a3d6f6f33ebf15a8c232299254ea9ab94853952 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-07  Andrew Pinski  <apinski@cavium.com>
+
+       * gcc.c-torture/execute/20141107-1.c: New testcase.
+
 2014-11-07  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63605
diff --git a/gcc/testsuite/gcc.c-torture/execute/20141107-1.c b/gcc/testsuite/gcc.c-torture/execute/20141107-1.c
new file mode 100644 (file)
index 0000000..e4590b3
--- /dev/null
@@ -0,0 +1,27 @@
+#define bool _Bool
+
+bool f(int a, bool c) __attribute__((noinline));
+bool f(int a, bool c)
+{
+  if (!a)
+    c = !c;
+  return c;
+}
+
+void checkf(int a, bool b)
+{
+  bool c = f(a, b);
+  char d;
+  __builtin_memcpy (&d, &c, 1);
+  if ( d != (a==0)^b)
+    __builtin_abort();
+}
+
+int main(void)
+{
+  checkf(0, 0);
+  checkf(0, 1);
+  checkf(1, 1);
+  checkf(1, 0);
+  return 0;
+}