gcc ICE on bitfield pack/unpack
Issue
With the following reduced testcase, gcc from redhat 6 segfaults.
// /usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1 -fpreprocessed t.i -quiet -dumpbase t.i -mtune=generic -auxbase-strip /dev/null -O2 -o - -frandom-seed=0
extern long *fun_1(void);
static void *fun_2(long *p)
{
union {
struct {
unsigned pos1 : 6;
unsigned pos2 : 26;
};
int v;
} u;
u.v = 0;
if (!(p[u.pos2] & (1UL << u.pos1))) {
fun_3();
p[u.pos2] |= 1UL << u.pos1;
}
}
void *fun_4(void *set)
{
long *en;
for (en = fun_1();;) {
fun_2(en);
}
}
Environment
- Red Hat Enterprise Linux 6.0
- x86_64
- gcc-4.4.6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.