List, does any one know why gcc complains? cc -E generates this post
cpp code for vmstat.c, starting line 90:
if(vd->mode&(0001000|0000100|0002000))
{ while(b < endb)
{ s = ((b)->head.head.size.size)&~(07);
if(((((b)->head.head.size.size)) & (04)) ||
!((((b)->head.head.size.size)) & (01)))
{ if(s > st->m_free)
st->m_free = s;
st->s_free += s;
st->n_free += 1;
}
else
{ if(vd->mode&0001000)
s = (((Head_t*)((Vmuchar_t*)(((Vmuchar_t*)(((void*)((b)->body.data)
)) + 2*sizeof(Head_t))) - 2*sizeof(Head_t)))->head.size.size );
else if(vd->mode&0002000)
s = (((Head_t*)((Vmuchar_t*)(((void*)((b)->body.data)
))+(((((Block_t*)((char*)(((void*)((b)->body.data) )) -
sizeof(Head_t)) ))->head.head.size.size)&~(07))-sizeof(Head_t))
)->head.size.size);
if(s > st->m_busy)
st->m_busy = s;
st->s_busy += s;
st->n_busy += 1;
}
The offender is line 100:
s = (((Head_t*)((Vmuchar_t*)(((Vmuchar_t*)(((void*)((b)->body.data)
)) + 2*sizeof(Head_t))) - 2*sizeof(Head_t)))->head.size.size );
Does any one spot the problem? I don not grok the problem.
Olga
2012/2/15 ольга крыжановская <[email protected]>:
> Glenn, in libast's vmalloc I get this warning if I compile libast on
> Suse Linux with gcc4 and CCFLAGS='-O3 -flto -fstrict-aliasing
> -Wstrict-aliasing': src/lib/libast/vmalloc/vmstat.c:100:7: warning:
> dereferencing type-punned pointer will break strict-aliasing rules
> This appears to be the only aliasing related warning.
>
> Olga
> --
> , _ _ ,
> { \/`o;====- Olga Kryzhanovska -====;o`\/ }
> .----'-/`-/ [email protected] \-`\-'----.
> `'-..-| / http://twitter.com/fleyta \ |-..-'`
> /\/\ Solaris/BSD//C/C++ programmer /\/\
> `--` `--`
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ [email protected] \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers