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

2023-05-06 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45221 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |8.0 Resolution|---

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

2011-05-17 Thread navin.kumar at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45221 Navin Kumar changed: What|Removed |Added Version|4.5.0 |4.6.0 --- Comment #11 from Navin Kumar 201

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

2010-08-07 Thread navin dot kumar at gmail dot com
--- Comment #10 from navin dot kumar at gmail dot com 2010-08-07 17:27 --- Richard, correct references in C++ cannot bind to NULL. So gcc should derive non-NULL-ness when the argument is a reference. It seems to correctly do this in the case of foo3 and fooB, but fails to do so for fo

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

2010-08-07 Thread rguenth at gcc dot gnu dot org
--- Comment #9 from rguenth at gcc dot gnu dot org 2010-08-07 16:27 --- (In reply to comment #7) > Richard, if you can't derive non-NULL-ness from X& y = *x, how do foo3 and > fooB > avoid the null check? For both cases the C++ frontend do not emit the NULL check. -- http://gcc.gn

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

2010-08-07 Thread rguenth at gcc dot gnu dot org
--- Comment #8 from rguenth at gcc dot gnu dot org 2010-08-07 16:25 --- Which means that if the language guarantees that for Base2* fooA(Derived* x) { Base2& y = *x; return &y; } x being a null pointer invokes undefined behavior (because references can't bind to nothing(?)) the

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

2010-08-07 Thread navin dot kumar at gmail dot com
--- Comment #7 from navin dot kumar at gmail dot com 2010-08-07 16:22 --- Richard, if you can't derive non-NULL-ness from X& y = *x, how do foo3 and fooB avoid the null check? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45221

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

2010-08-07 Thread rguenth at gcc dot gnu dot org
--- 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 o

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

2010-08-07 Thread navin dot kumar at gmail dot com
--- 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, dereferen

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

2010-08-07 Thread rguenth at gcc dot gnu dot org
--- Comment #4 from rguenth at gcc dot gnu dot org 2010-08-07 10:37 --- I don't see what the bug is here - this is a feature of the C++ standard, we can't really "optimize" anything here. 5.2.9/8 ... The null pointer value is converted to the null pointer value of the destination type.