diff gcc/testsuite/gcc.dg/pr84877.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/pr84877.c	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <inttypes.h>
+
+struct U {
+    int M0;
+    int M1;
+} __attribute ((aligned (16)));
+
+volatile struct U p0 = {1, 0};
+
+void __attribute__ ((noinline))
+foo (struct U p)
+{
+
+  volatile intptr_t mask = 0b1111;
+  volatile int dummy[2];
+  struct U p1 = p;
+  dummy[1] = p.M0;
+
+  if ((intptr_t)(&p1) & mask)
+    __builtin_abort ();
+  if ((intptr_t)(&p) & mask)
+    __builtin_abort ();
+
+  if (p1.M0 != dummy[1])
+    __builtin_abort ();
+  if (p1.M1 != p.M1)
+    __builtin_abort ();
+}
+
+int
+main ()
+{
+  foo (p0);
+  return 0;
+}