Hi!
This patch allows to fold n + 1 != 0 into true for automatic array n.
We already handle it for variables in the symbol table (if not weak),
but automatic vars are never in the symbol table.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Or shall I add the function local
On Tue, 10 Jan 2017, Jakub Jelinek wrote:
> Hi!
>
> This patch allows to fold n + 1 != 0 into true for automatic array n.
> We already handle it for variables in the symbol table (if not weak),
> but automatic vars are never in the symbol table.
>
> Bootstrapped/regtested on x86_64-linux and i68
On Wed, Jan 11, 2017 at 09:31:38AM +0100, Richard Biener wrote:
> > Or shall I add the function local address check into maybe_nonzero_address
> > instead (return 1 for those)?
>
> Yes please, and cleanup the other user of maybe_nonzero_address then
> (which contains the code you added).
Ok, I'll
On Wed, 11 Jan 2017, Jakub Jelinek wrote:
> On Wed, Jan 11, 2017 at 09:31:38AM +0100, Richard Biener wrote:
> > > Or shall I add the function local address check into maybe_nonzero_address
> > > instead (return 1 for those)?
> >
> > Yes please, and cleanup the other user of maybe_nonzero_address
On 01/10/2017 11:40 PM, Jakub Jelinek wrote:
+constexpr bool
+foo ()
+{
+ constexpr int n[42] = { 1 };
+ constexpr int o = n ? 1 : 0;
+ constexpr int p = n + 1 ? 1 : 0;
+ constexpr int q = "abc" + 1 ? 1 : 0;
+ return p + p + q == 3;
+}
Not o + p + q ?
John.
On Wed, Jan 11, 2017 at 10:27:23PM +0100, John Tytgat wrote:
> On 01/10/2017 11:40 PM, Jakub Jelinek wrote:
> > +constexpr bool
> > +foo ()
> > +{
> > + constexpr int n[42] = { 1 };
> > + constexpr int o = n ? 1 : 0;
> > + constexpr int p = n + 1 ? 1 : 0;
> > + constexpr int q = "abc" + 1 ? 1 :