This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)
- From: Marek Polacek <polacek at redhat dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 24 Sep 2015 11:32:06 +0200
- Subject: Re: [ubsan PATCH] Fix uninitialized var issue (PR sanitizer/64906)
- Authentication-results: sourceware.org; auth=none
- References: <20150922151142 dot GO27588 at redhat dot com> <56028845 dot 4020708 at redhat dot com> <20150923160708 dot GT27588 at redhat dot com> <5602F5B9 dot 8040600 at redhat dot com>
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 above. Do you agree?
>
> Sounds reasonable. If you can find a point in the history where that code
> wasn't useless, it would be good to help us understand why it's there.
I did some archeology. The code wasn't useless since it was added (r211859)
till r226110 where I added some unshare_exprs. On the testcase I posted
earlier in the thread that makes a difference:
@@ -11,7 +11,7 @@
else
{
<<< Unknown tree: void_cst >>>
- }, (long unsigned int) (s->a[i] << SAVE_EXPR <i>);;
+ }, (long unsigned int) (s->a[UBSAN_BOUNDS (0B, SAVE_EXPR <i>, 0);,
SAVE_EXPR <i>;] << SAVE_EXPR <i>);;
}
So we instrument the array multiple times as it's not shared anymore.
Ok to proceed with the plan I mentioned above?
Marek