I think this has been fixed in 4.6 (not on the 4.5 branch though) which
no longer performs this substitution. You can work around this using
-fno-ipa-sra.
The following is a simplified testcase:
extern "C" void abort (void);
struct S
{
void __attribute__((noinline)) set(unsigned val)
{
data = val;
if (data != val)
abort ();
}
int pad0;
unsigned pad1 : 8;
unsigned data : 24;
int pad2;
};
int main()
{
S s;
s.pad2 = -1;
s.set(0);
if (s.pad2 != -1)
abort ();
}
Where 4.6 says:
Candidate (2069): this
! Disqualifying this - Encountered a bit-field access.
It's a bug in IPA-SRA that creates non-mode-size stores:
void llvm::Type: :_ZN4llvm4Type1 5setSubclassDat aEj.clone. 1(unsigned int:24*, unsigned int) (<unnamed- unsigned: 24> * ISRA.6, unsigned int val) unsigned: 24>) val_1(D);
{
...
<bb 2>:
D.87358_2 = (<unnamed-
*ISRA.6_8(D) = D.87358_2;
I think this has been fixed in 4.6 (not on the 4.5 branch though) which
no longer performs this substitution. You can work around this using
-fno-ipa-sra.
The following is a simplified testcase:
extern "C" void abort (void); _((noinline) ) set(unsigned val)
struct S
{
void __attribute_
{
data = val;
if (data != val)
abort ();
}
int pad0;
unsigned pad1 : 8;
unsigned data : 24;
int pad2;
};
int main()
{
S s;
s.pad2 = -1;
s.set(0);
if (s.pad2 != -1)
abort ();
}
Where 4.6 says:
Candidate (2069): this
! Disqualifying this - Encountered a bit-field access.
which hints at what needs backporting.
Martin?