aboutsummaryrefslogtreecommitdiffstats
path: root/test/CFrontend
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-25 22:36:24 +0000
committerChris Lattner <sabre@nondot.org>2008-01-25 22:36:24 +0000
commit0298dbf01997b05336deec3d77fd66a8ae96df64 (patch)
tree0063cdabb72ab1cbd2406046b34b4fba3dda2e45 /test/CFrontend
parent255bd2852b7e23591fc66434a4a10ecf5bf4a615 (diff)
downloadexternal_llvm-0298dbf01997b05336deec3d77fd66a8ae96df64.zip
external_llvm-0298dbf01997b05336deec3d77fd66a8ae96df64.tar.gz
external_llvm-0298dbf01997b05336deec3d77fd66a8ae96df64.tar.bz2
add a testcase for a bug Duncan pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46372 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CFrontend')
-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 0000000..afbf970
--- /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]; }
+