aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-05 16:15:29 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-05 16:15:29 +0000
commit894bbab6314e85b5bdc5b03b97d8561fbe8545a7 (patch)
tree4288571f0cba26b82ddb92468814f7ece180b44c
parentda8bf14c016231d68bc89344f7d95e575fc4145a (diff)
Add test case for PR2001.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54352 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/PR2001-bitfield-reload.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/PR2001-bitfield-reload.c b/test/CodeGen/PR2001-bitfield-reload.c
new file mode 100644
index 0000000000..caafced935
--- /dev/null
+++ b/test/CodeGen/PR2001-bitfield-reload.c
@@ -0,0 +1,17 @@
+// RUN: clang --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t &&
+// RUN: grep "ret i32" %t | count 1 &&
+// RUN: grep "ret i32 1" %t | count 1
+// PR2001
+
+/* Test that the result of the assignment properly uses the value *in
+ the bitfield* as opposed to the RHS. */
+static int foo(int i) {
+ struct {
+ int f0 : 2;
+ } x;
+ return (x.f0 = i);
+}
+
+int bar() {
+ return foo(-5) == -1;
+}