summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr41340.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/pr41340.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr41340.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr41340.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr41340.c b/gcc/testsuite/gcc.dg/pr41340.c
new file mode 100644
index 000000000..b86f40bf4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr41340.c
@@ -0,0 +1,71 @@
+/* PR debug/41340 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -g -fcompare-debug" } */
+/* { dg-options "-O3 -g -fcompare-debug -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-skip-if "no long pointers" { { ! ilp32 } && { ! lp64 } } } */
+
+typedef struct { int t; } *T;
+struct S1 { unsigned s1; };
+struct S2 { struct S1 s2; };
+struct S3 { unsigned s3; struct S2 **s4; };
+struct S5 { struct S2 *s5; };
+
+__extension__ typedef __INTPTR_TYPE__ ssize_t;
+
+extern void fn0 (void) __attribute__ ((__noreturn__));
+T fn6 (struct S3);
+void fn7 (void);
+
+static inline __attribute__((always_inline)) int
+fn1 (const struct S1 *x)
+{
+ return x->s1;
+}
+
+static inline __attribute__((always_inline)) int
+fn2 (const struct S1 *x, unsigned y)
+{
+ if (y >= x->s1)
+ fn0 ();
+ return 0;
+}
+
+static inline __attribute__((always_inline)) int
+fn3 (struct S3 x)
+{
+ return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0));
+}
+
+static inline __attribute__((always_inline)) int
+fn4 (struct S3 x)
+{
+ return fn2 (&(*x.s4)->s2, x.s3);
+}
+
+int
+fn5 (struct S3 x, T *y)
+{
+ if (!fn3 (x))
+ {
+ *y = (T) (ssize_t) fn4 (x);
+ return 1;
+ }
+ return 0;
+}
+
+void
+test (struct S5 *x)
+{
+ struct S3 a;
+ T b;
+ unsigned char c = 0;
+ a.s4 = &x->s5;
+ while (fn5 (a, &b))
+ if (!(b->t & 8))
+ c = 1;
+ a.s4 = &x->s5;
+ while ((b = fn6 (a)))
+ ;
+ if (!c)
+ fn7 ();
+}