1*67e74705SXin Li // RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s 2*67e74705SXin Li // PR2001 3*67e74705SXin Li 4*67e74705SXin Li /* Test that the result of the assignment properly uses the value *in 5*67e74705SXin Li the bitfield* as opposed to the RHS. */ foo(int i)6*67e74705SXin Listatic int foo(int i) { 7*67e74705SXin Li struct { 8*67e74705SXin Li int f0 : 2; 9*67e74705SXin Li } x; 10*67e74705SXin Li return (x.f0 = i); 11*67e74705SXin Li } 12*67e74705SXin Li bar()13*67e74705SXin Liint bar() { 14*67e74705SXin Li // CHECK: ret i32 1 15*67e74705SXin Li return foo(-5) == -1; 16*67e74705SXin Li } 17