[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: Request to merge Undefined Behavior Sanitizer in (take 2)
From:       Jason Merrill <jason () redhat ! com>
Date:       2013-07-31 18:52:39
Message-ID: 51F95CF7.8020605 () redhat ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic