------- Comment #5 from navin dot kumar at gmail dot com 2010-08-07 15:25 ------- Hi Richard,
Your explanation doesn't explain why foo1 would emit poorer assembly than foo3. Or for that matter why fooA would emit poorer assembly than fooB. In the case of foo1, foo3, fooA, and fooB, dereferencing occurs first, before casting. Yet only foo3 and fooB generate optimal assembly (so gcc is clearly "capable" of outputting the desired asm). This is all at -O3, where "-fdelete-null-pointer-checks" is already enabled. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45221