This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Request to merge Undefined Behavior Sanitizer in (take 2)
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Jeff Law <law at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 31 Jul 2013 14:52:39 -0400
- Subject: Re: Request to merge Undefined Behavior Sanitizer in (take 2)
- References: <20130725153227 dot GC32538 at redhat dot com> <51F186E9 dot 9090404 at redhat dot com> <20130731173321 dot GT17022 at redhat dot com>
On 07/31/2013 01:33 PM, Marek Polacek wrote:
There are still at least two issues though, which is why
bootstrap with -fsanitize=undefined fails:
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg01480.html
This looks like a serious bug, properly caught by -Wuninitialized.
When sanitizing,
in .uninit1 we have
int x.3;
int x.2;
<bb 2>:
x.3_3 = x.2_1(D) >> 1;
x = x.3_3;
Note that x.2 is not initialized.
and when no sanitizing
int x.1;
int x.0;
<bb 2>:
x.0_2 = x;
x.1_3 = x.0_2 >> 1;
x = x.1_3;
But here x.0 is initialized.
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg01536.html
Here, the C++ compiler is wrong to fold away the division by zero, but
given that bug the folding ought to also eliminate the call to the
sanitize function. Seems like you should attach the call to the
questionable expression itself.
Jason