aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/attr-retain-10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/attr-retain-10.c')
-rw-r--r--gcc/testsuite/c-c++-common/attr-retain-10.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/attr-retain-10.c b/gcc/testsuite/c-c++-common/attr-retain-10.c
new file mode 100644
index 0000000..0bac947
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-retain-10.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target R_flag_in_section } } */
+/* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */
+/* { dg-options "-Wall -O2 -fno-toplevel-reorder" } */
+
+int __attribute__((used,retain,section(".data.foo"))) foo2 = 2;
+int between = 1;
+int __attribute__((section(".data.foo"))) foo1 = 1;
+/* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */
+
+/* { dg-final { scan-assembler ".data.foo,\"aw\"" { target R_flag_in_section } } } */
+/* { dg-final { scan-assembler ".data.foo,\"awR\"" { target R_flag_in_section } } } */