This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request to merge Undefined Behavior Sanitizer in (take 2)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]