pkgsrc-ng/lang/gcc45/patches/patch-gcc_testsuite_gcc.dg_torture_pr49651.c
Lionel Sambuc 612ad0a18c lang/gcc45
2016-01-22 00:09:29 +01:00

37 lines
538 B
C

$NetBSD$
--- gcc/testsuite/gcc.dg/torture/pr49651.c.orig Wed May 21 19:48:58 2014
+++ gcc/testsuite/gcc.dg/torture/pr49651.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+struct X {
+ int *p;
+ int *q;
+};
+
+void __attribute__((noinline, noclone))
+foo (struct X x) { *x.q = 0; }
+
+volatile int what;
+struct X y;
+
+int main()
+{
+ int i, j;
+ struct X x, *p;
+ x.p = &i;
+ x.q = &j;
+ if (what)
+ p = &y;
+ else
+ p = &x;
+ j = 1;
+ foo (*p);
+ if (j != 0)
+ abort ();
+ return 0;
+}