summaryrefslogtreecommitdiff
path: root/libmudflap/testsuite/libmudflap.c/fail27-frag.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmudflap/testsuite/libmudflap.c/fail27-frag.c')
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail27-frag.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libmudflap/testsuite/libmudflap.c/fail27-frag.c b/libmudflap/testsuite/libmudflap.c/fail27-frag.c
new file mode 100644
index 00000000000..7168dfc61b2
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail27-frag.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char volatile *
+__attribute__((noinline))
+foo (unsigned i)
+{
+ char volatile buffer[10];
+ char volatile *k = i ? & buffer[i] : NULL; /* defeat addr-of-local-returned warning */
+ return k;
+}
+
+int main ()
+{
+char volatile *f = foo (5);
+f[0] = 'b';
+
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*buffer.*alloc.*dealloc" } */
+/* { dg-do run { xfail *-*-* } } */