------- Comment #3 from tsv at solvo dot ru 2005-10-04 05:59 ------- (In reply to comment #2) > (In reply to comment #0) > > > The offset of "p5" member is 25 bytes, but compiler thinks that "p5" is > > aligned > > in "foo" function > > You are casting a pointer to a Foo* that doesn't have proper alignment for > a Foo. This is undefined behavior, so anything can happen, including an > unaligned access at some later point. This is not a gcc bug. Correct me if I wrong, but loading long from passed pointer to char minus 4 is not correct too. I could agree if the compiler did substruct 25 from pointer and added 24 and that did load (it does it in not optimized version). In this case it would me me who passed incorrect pointer (in fact DEC C did that) and I agree with compiler that warns me about it. I can't test right now, but if I recall gcc 3.4 didn't have such problems.
> > > It might be not very good coding practice, but it taken from Mozilla source. > > Please report it there instead. > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24178