From: Daniel Dunbar Date: Tue, 5 Aug 2008 16:15:29 +0000 (+0000) Subject: Add test case for PR2001. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=894bbab6314e85b5bdc5b03b97d8561fbe8545a7;p=clang Add test case for PR2001. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54352 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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; +}