------- Comment #6 from rguenth at gcc dot gnu dot org 2008-12-05 12:57 ------- This is sra_build_assignment/sra_build_bf_assignments way of "lowering" a BIT_FIELD_REF to integer arithmetic. We hit the !INTEGRAL_TYPE_P (TREE_TYPE (var)) paths and for
BIT_FIELD_REF <*p_1(D), 32, 0> we create VIEW_CONVERT_EXPR <long long> (*p) and extract the lower/upper 32 bits by shifting and masking. This obviously "uses" possibly uninitialized parts of *p or s0. The problem here is that we interestingly split the initialization of s0 to the upper part s0.c ={v} s0$c_7; and the lower part SR.3_8 = VIEW_CONVERT_EXPR<long long unsigned int>(s0); SR.4_9 = SR.3_8 & 0xffffffff00000000; SR.5_10 = (long long unsigned int) s0$B0F32_5; SR.6_11 = SR.4_9 | SR.5_10; s0 ={v} VIEW_CONVERT_EXPR<struct xxx>(SR.6_11); this is likely because SRA really wants to have two 32bit fields but it cannot deal with the larger struct with a VIEW_CONVERT_EXPR. With just disabling all these code-paths we get <bb 2>: s0$B0F32_4 = 0; s0$c_5 = p_1(D)->c; s0$B0F32_6 = BIT_FIELD_REF <*p_1(D), 32, 0>; s0.c ={v} s0$c_5; BIT_FIELD_REF <s0, 32, 0> ={v} s0$B0F32_6; s ={v} s0; s$a_7 = s.a; D.1242_2 = s$a_7; and no warning. But of course we now have bitfield refs that are not optimized (not scalarizing in this case would be better). Of course even with the current scalarization we finally arrive with <bb 2>: # VUSE <SMT.16_13(D)> s0$c_7 = p_1(D)->c; # VUSE <SMT.16_13(D)> D.1249_4 = VIEW_CONVERT_EXPR<long long unsigned int>(*p_1(D)); s0$B0F32_5 = (unsigned int) D.1249_4; # VUSE <s0_14(D)> SR.21_24 = VIEW_CONVERT_EXPR<long long unsigned int>(s0); SR.22_25 = SR.21_24 & 0xffffffff00000000; # s0_28 = VDEF <s0_14(D)> s0 = VIEW_CONVERT_EXPR<struct xxx>(SR.22_25); # s0_29 = VDEF <s0_28> s0.c = s0$c_7; # VUSE <s0_29> SR.3_8 = VIEW_CONVERT_EXPR<long long unsigned int>(s0); SR.4_9 = SR.3_8 & 0xffffffff00000000; SR.5_10 = (long long unsigned int) s0$B0F32_5; SR.6_11 = SR.5_10 | SR.4_9; s0$B0F32_21 = (unsigned int) SR.6_11; s0$c_30 = VIEW_CONVERT_EXPR<struct xxx>(SR.6_11).c; # VUSE <s0_29> SR.25_31 = VIEW_CONVERT_EXPR<long long unsigned int>(s0); SR.26_32 = SR.25_31 & 0xffffffff00000000; SR.27_33 = (long long unsigned int) s0$B0F32_21; SR.28_34 = SR.27_33 | SR.26_32; # s0_35 = VDEF <s0_29> s0 = VIEW_CONVERT_EXPR<struct xxx>(SR.28_34); # s0_36 = VDEF <s0_35> s0.c = s0$c_30; # VUSE <s0_36> # s_18 = VDEF <s_17(D)> s = s0; # VUSE <s_18> s$a_37 = s.a; # s_39 = VDEF <s_18> s.a = s$a_37; # VUSE <s_39> # SMT.16_20 = VDEF <SMT.16_13(D)> bar (s); return; because we seem to scalarize again. Ugh. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38271