aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/CFrontend/2008-01-25-ByValReadNone.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CFrontend/2008-01-25-ByValReadNone.c b/test/CFrontend/2008-01-25-ByValReadNone.c
new file mode 100644
index 0000000000..afbf97066c
--- /dev/null
+++ b/test/CFrontend/2008-01-25-ByValReadNone.c
@@ -0,0 +1,10 @@
+// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep readonly
+// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | not grep readnone
+
+
+// The struct being passed byval means that we need to mark the
+// function readonly instead of readnone. Readnone would allow
+// stores to the arg to be deleted in the caller.
+struct S { int A[1000]; };
+int __attribute__ ((const)) f(struct S x) { return x.A[0]; }
+