On 12/05/2016 10:00 AM, Jakub Jelinek wrote:
Hi!
As the testcase shows, we also want to fold "abcd" + 3 != NULL
at constant time. The following patch fixes that.
Additionally, I think if !indirect_base0 then we basically want to compare
whether the base0's value rather than address is non-NULL, which we can't
optimize. All we can optimize is when indirect_base0 is true, i.e. we
want to ask whether base0's address + some constant offset is non-NULL.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2016-12-05 Jakub Jelinek <ja...@redhat.com>
PR c++/71537
* fold-const.c (fold_comparison): Assume CONSTANT_CLASS_P (base0)
plus offset is non-zero. For maybe_nonzero_address decl base0,
require indirect_base0.
* g++.dg/cpp0x/constexpr-71537.C: New test.
OK.
jeff