aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c
new file mode 100644
index 000000000..30e2bca6f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/attr-may-alias-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "dont_delete" } } */
+
+typedef struct { int x; } __attribute__((may_alias)) S;
+
+extern void dont_delete (void);
+
+void f(S *s, float *f)
+{
+ s->x = 1;
+ *f = 0;
+ if (s->x != 1)
+ dont_delete ();
+}