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