aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c
new file mode 100644
index 000000000..9b92e9bbf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdbool.h>
+#include <sanitizer/asan_interface.h>
+
+struct vfsmount {};
+struct dentry {};
+
+struct path {
+ struct vfsmount *mnt;
+ struct dentry *dentry;
+};
+
+struct fs_struct {
+ int users;
+ int lock;
+ int seq;
+ int umask;
+ int in_exec;
+ struct path root, pwd;
+};
+
+void __attribute__((noinline, noclone))
+copy_fs_struct(struct fs_struct *a, struct fs_struct *b) {
+ a->root = b->root;
+}
+
+struct fs_struct a, b;
+
+int
+main () {
+ __asan_poison_memory_region (&a.root, sizeof (a.root));
+ copy_fs_struct (&a, &b);
+ return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */