Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-08 Thread Manish Goregaokar
Yep, there are some test issues -- I don't have time right now but plan to investigate further later. -Manish On Sat, Jul 9, 2016 at 12:06 AM, Jeff Law wrote: > On 07/06/2016 11:22 AM, Bernd Schmidt wrote: >> >> On 07/05/2016 12:41 PM, Richard Biener wrote: >>> >>> On Fri, Jul

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-08 Thread Jeff Law
On 07/06/2016 11:22 AM, Bernd Schmidt wrote: On 07/05/2016 12:41 PM, Richard Biener wrote: On Fri, Jul 1, 2016 at 3:10 PM, Manish Goregaokar wrote: Added a test: Ok if this passed bootstrap/regtest. + return flag_delete_null_pointer_checks +&&

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-06 Thread Bernd Schmidt
On 07/05/2016 12:41 PM, Richard Biener wrote: On Fri, Jul 1, 2016 at 3:10 PM, Manish Goregaokar wrote: Added a test: Ok if this passed bootstrap/regtest. + return flag_delete_null_pointer_checks +&& (tree_expr_nonzero_warnv_p (op0, strict_overflow_p) +

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-05 Thread Richard Biener
On Fri, Jul 1, 2016 at 3:10 PM, Manish Goregaokar wrote: > Added a test: Ok if this passed bootstrap/regtest. Richard. > gcc/ChangeLog: > PR c/71699 > * fold-const.c (tree_binary_nonzero_warnv_p): Allow > pointer addition to also be considered nonzero. > >

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-04 Thread Mike Stump
On Jul 1, 2016, at 6:10 AM, Manish Goregaokar wrote: > > +} > \ No newline at end of file Minor nit, please end all files with a newline...

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-01 Thread Manish Goregaokar
Added a test: gcc/ChangeLog: PR c/71699 * fold-const.c (tree_binary_nonzero_warnv_p): Allow pointer addition to also be considered nonzero. gcc/testsuite/ChangeLog: PR c/71699 * c-c++-common/pointer-addition-nonnull.c: New test for pointer addition. --- gcc/fold-const.c

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-07-01 Thread Richard Biener
On Thu, Jun 30, 2016 at 5:14 PM, Marc Glisse wrote: > On Thu, 30 Jun 2016, Richard Biener wrote: > >> points-to analysis already has the constraint that POINTER_PLUS_EXPR >> cannot leave the object op0 points to. Of course currently nothing uses the >> fact whether

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Manish Goregaokar
This is the full test failure summary. I will compare with the previous commit tomorrow. The asan failure and the uninit-19 failure are interesting. uninit-19 should not have failed, but I have no idea what's going on with asan. I'll have a closer look tomorrow and look for other failing tests.

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Marc Glisse
On Thu, 30 Jun 2016, Richard Biener wrote: points-to analysis already has the constraint that POINTER_PLUS_EXPR cannot leave the object op0 points to. Of course currently nothing uses the fact whether points-to computes pointed-to as nothing (aka NULL) - so the argument may be moot.

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Manish Goregaokar
I'm getting a failure on ./gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c with the latest patch. Unsure if it's related; we're not doing any pointer arithmetic there. I'll test it again on trunk without the patch and see what happens. -Manish On Thu, Jun 30, 2016 at 7:18 PM, Richard

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Richard Biener
On Thu, Jun 30, 2016 at 3:38 PM, Marc Glisse wrote: > On Thu, 30 Jun 2016, Manish Goregaokar wrote: > >> Alright, the following patch was tested and it works >> >> diff --git a/gcc/fold-const.c b/gcc/fold-const.c >> index 3b9500d..0d82018 100644 >> --- a/gcc/fold-const.c >>

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Marc Glisse
On Thu, 30 Jun 2016, Manish Goregaokar wrote: Alright, the following patch was tested and it works diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3b9500d..0d82018 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13199,6 +13199,9 @@ tree_binary_nonzero_warnv_p (enum tree_code

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Manish Goregaokar
Alright, the following patch was tested and it works diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3b9500d..0d82018 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13199,6 +13199,9 @@ tree_binary_nonzero_warnv_p (enum tree_code code, switch (code) { case

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Richard Biener
On Thu, Jun 30, 2016 at 2:03 PM, Manish Goregaokar wrote: > What about ptr + intptr_t? I guess we should check nonnegative for op1 then? op1 will always be nonnegative as it is forced to sizetype type (which is unsigned). Richard. > -Manish > > > On Thu, Jun 30, 2016 at

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Manish Goregaokar
What about ptr + intptr_t? I guess we should check nonnegative for op1 then? -Manish On Thu, Jun 30, 2016 at 5:25 PM, Richard Biener wrote: > On Thu, Jun 30, 2016 at 1:17 PM, Manish Goregaokar wrote: >> gcc/ChangeLog: >> PR c/71699 >> *

Re: [PATCH PR c/71699] Handle pointer arithmetic in nonzero tree checks

2016-06-30 Thread Richard Biener
On Thu, Jun 30, 2016 at 1:17 PM, Manish Goregaokar wrote: > gcc/ChangeLog: > PR c/71699 > * fold-const.c (tree_binary_nonzero_warnv_p): Allow > pointer addition to also be considered nonzero. > --- > gcc/fold-const.c | 20 +--- > 1 file changed, 13