]> gcc.gnu.org Git - gcc.git/commitdiff
New test case.
authorRichard Henderson <rth@gcc.gnu.org>
Mon, 8 Nov 2004 18:53:59 +0000 (10:53 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 8 Nov 2004 18:53:59 +0000 (10:53 -0800)
From-SVN: r90280

gcc/testsuite/gcc.dg/20041106-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/20041106-1.c b/gcc/testsuite/gcc.dg/20041106-1.c
new file mode 100644 (file)
index 0000000..538f2dd
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do run { target *-*-linux* *-*-solaris* } } */
+/* { dg-options -O2 } */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+struct S { long x __attribute__((packed)); };
+volatile long sink;
+
+void foo (struct S *s)
+{
+  sink = s->x;
+}
+
+int main ()
+{
+  size_t ps = getpagesize ();
+  char *ptr, *page;
+  struct S *s;
+
+  ptr = malloc (3*ps);
+  page = (char *)(((size_t)ptr + (ps - 1)) & -ps);
+  munmap (page + ps, ps);
+
+  s = (struct S *)(page + ps - sizeof(struct S));
+  foo(s);
+
+  return 0;
+}
This page took 0.064775 seconds and 5 git commands to generate.