public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [ubsan] Add bootstrap-ubsan.mk
Date: Tue, 30 Jul 2013 17:04:00 -0000	[thread overview]
Message-ID: <20130730165623.GN17022@redhat.com> (raw)
In-Reply-To: <20130730143414.GL17022@redhat.com>

On Tue, Jul 30, 2013 at 04:34:14PM +0200, Marek Polacek wrote:
> This adds the bootstrap-ubsan.mk file so that
> --with-build-config=bootstrap-ubsan be possible.  I doesn't work yet,
> though :(.

One of the reasons is that we use -Werror and e.g. on the following
testcase

static int x;
void
foo (void)
{
  int o = 1;
  x = x >> o;
}

with -O -fsanitize=undefined we generate:
c.c:6:9: warning: ‘x.2’ is used uninitialized in this function [-Wuninitialized]
   x = x >> o;
while with -O -fno-sanitize=undefined there isn't such warning.  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;
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;

The warning comes from warn_uninitialized_vars.  The warning here seems
incorrect, but I'm afraid there isn't much to do about this on the
ubsan side of things.

	Marek

      reply	other threads:[~2013-07-30 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 14:42 Marek Polacek
2013-07-30 17:04 ` Marek Polacek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130730165623.GN17022@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).