diff options
author | rus <rus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-09 20:58:24 +0000 |
---|---|---|
committer | rus <rus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-09 20:58:24 +0000 |
commit | 7f4db7c80779ecbc57d1146654daf0acfe18de66 (patch) | |
tree | 3af522a3b5e149c3fd498ecb1255994daae2129a /gcc/testsuite/gcc.dg/debug/vta-1.c | |
parent | 611349f0ec42a37591db2cd02974a11a48d10edb (diff) | |
download | gcc-profile-stdlib.tar.gz |
merge from trunkprofile-stdlib
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@154052 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/debug/vta-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/vta-1.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/debug/vta-1.c b/gcc/testsuite/gcc.dg/debug/vta-1.c new file mode 100644 index 00000000000..414083a09c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/vta-1.c @@ -0,0 +1,34 @@ +/* https://bugzilla.redhat.com/show_bug.cgi?id=521991#c5 + + Distilled from Linux XFS source code. foo, inlined into bar, ends + up with debug stmts referencing the addressable variable b. + Optimization made it non-addressable, and then completely optimized + away, before we got a chance to rename (and discard) the occurrence + in the debug stmt. When we did, we crashed, attempting to rename + an unreference variable. */ + +/* { dg-do compile } */ + +static inline int +foo (void *x, unsigned y) +{ + unsigned z = *(unsigned long *) x % y; + *(unsigned long *) x = *(unsigned long *) x / y; + return z; +} + +struct S +{ + unsigned t; +}; + +void +bar (struct S *x, int *y) +{ + int a = 0; + unsigned long b = x->t; + foo (&b, x->t); + for (;; a++) + if (b) + *y = 1; +} |