[cfe-commits] r54352 - /cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c

Daniel Dunbar daniel at zuster.org
Tue Aug 5 09:15:38 PDT 2008


Author: ddunbar
Date: Tue Aug  5 11:15:29 2008
New Revision: 54352

URL: http://llvm.org/viewvc/llvm-project?rev=54352&view=rev
Log:
Add test case for PR2001.

Added:
    cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c

Added: cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c?rev=54352&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c (added)
+++ cfe/trunk/test/CodeGen/PR2001-bitfield-reload.c Tue Aug  5 11:15:29 2008
@@ -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;
+}





More information about the cfe-commits mailing list