On Thu, Feb 18, 2016 at 10:51:48PM +0100, Jakub Jelinek wrote: > On Thu, Feb 18, 2016 at 10:45:46PM +0100, Jakub Jelinek wrote: > > Hi! > > > > And here is a fix for the dynamic_cast issue I've mentioned recently. > > Alternatively, ifnonnull could build instead NE_EXPR with swapped last > > two arguments on the COND_EXPR, and then I believe the cp_fold change would > > not be needed. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > Or do you prefer the NE_EXPR variant? > > Here is the variant with NE_EXPR, it works on *nonnull* tests, haven't > tested it more yet, but will overnight. > Personally I think this is better, because folding wants to canonicalize > the COND_EXPR with EQ_EXPR and no code in the then branch to NE_EXPR > with no code in the else branch, so it means we waste some more GC memory.
And even this patch passed bootstrap/regtest on x86_64-linux and i686-linux. > 2016-02-18 Jakub Jelinek <ja...@redhat.com> > > PR c++/69850 > * rtti.c (ifnonnull): Set TREE_NO_WARNING on the condition, use > NE_EXPR instead of EQ_EXPR and swap last two arguments on COND_EXPR. > > * g++.dg/warn/Wnonnull-compare-4.C: New test. Jakub