[Bug c++/45221] missed optimization with multiple bases and casting

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Aug 7 16:19:00 GMT 2010



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-08-07 16:19 -------
(In reply to comment #5)
> 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.

X* x;
X& = *x;

is not considered a dereference - internally it is just a pointer assignment
we can't derive non-NULL-ness from.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45221



More information about the Gcc-bugs mailing list