From 0298dbf01997b05336deec3d77fd66a8ae96df64 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 25 Jan 2008 22:36:24 +0000 Subject: [PATCH] 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 --- test/CFrontend/2008-01-25-ByValReadNone.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/CFrontend/2008-01-25-ByValReadNone.c diff --git a/test/CFrontend/2008-01-25-ByValReadNone.c b/test/CFrontend/2008-01-25-ByValReadNone.c new file mode 100644 index 00000000000..afbf97066c7 --- /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]; } + -- 2.34.1