Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-24 Thread Marek Polacek
On Wed, Sep 23, 2015 at 08:55:53PM +0200, Bernd Schmidt wrote: > On 09/23/2015 06:07 PM, Marek Polacek wrote: > >Given that the code above seems to be useless now, I think let's put this > >patch in as-is, backport it to gcc-5, then remove those redundant hunks on > >trunk and add the testcase

Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-24 Thread Bernd Schmidt
On 09/24/2015 11:32 AM, Marek Polacek wrote: On Wed, Sep 23, 2015 at 08:55:53PM +0200, Bernd Schmidt wrote: On 09/23/2015 06:07 PM, Marek Polacek wrote: Given that the code above seems to be useless now, I think let's put this patch in as-is, backport it to gcc-5, then remove those redundant

Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-23 Thread Bernd Schmidt
On 09/22/2015 05:11 PM, Marek Polacek wrote: diff --git gcc/c-family/c-ubsan.c gcc/c-family/c-ubsan.c index e0cce84..d2bc264 100644 --- gcc/c-family/c-ubsan.c +++ gcc/c-family/c-ubsan.c @@ -104,6 +104,7 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1) } } t =

Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-23 Thread Marek Polacek
On Wed, Sep 23, 2015 at 01:08:53PM +0200, Bernd Schmidt wrote: > On 09/22/2015 05:11 PM, Marek Polacek wrote: > > >diff --git gcc/c-family/c-ubsan.c gcc/c-family/c-ubsan.c > >index e0cce84..d2bc264 100644 > >--- gcc/c-family/c-ubsan.c > >+++ gcc/c-family/c-ubsan.c > >@@ -104,6 +104,7 @@

Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-23 Thread Bernd Schmidt
On 09/23/2015 06:07 PM, Marek Polacek wrote: Given that the code above seems to be useless now, I think let's put this patch in as-is, backport it to gcc-5, then remove those redundant hunks on trunk and add the testcase above. Do you agree? Sounds reasonable. If you can find a point in the

[ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)

2015-09-22 Thread Marek Polacek
This fixes sanitizer/64906 by also pre-evaluating OP1. The problem in this testcase is that OP1 is "SAVE_EXPR " which can't be folded any more, but when we're creating the EQ_EXPR -- checking whether this expression equals zero -- it can be folded further to "f == 0". Afterwards we end up with