* [ubsan] Add bootstrap-ubsan.mk
@ 2013-07-30 14:42 Marek Polacek
2013-07-30 17:04 ` Marek Polacek
0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2013-07-30 14:42 UTC (permalink / raw)
To: GCC Patches
This adds the bootstrap-ubsan.mk file so that
--with-build-config=bootstrap-ubsan be possible. I doesn't work yet,
though :(.
Tested x86_64-pc-linux-gnu, applying to ubsan branch.
diff --git a/config/ChangeLog.ubsan b/config/ChangeLog.ubsan
new file mode 100644
index 0000000..f7a2125
--- /dev/null
+++ b/config/ChangeLog.ubsan
@@ -0,0 +1,3 @@
+2013-07-30 Marek Polacek <polacek@redhat.com>
+
+ * bootstrap-ubsan.mk: New.
diff --git a/config/bootstrap-ubsan.mk b/config/bootstrap-ubsan.mk
new file mode 100644
index 0000000..10543f6
--- /dev/null
+++ b/config/bootstrap-ubsan.mk
@@ -0,0 +1,7 @@
+# This option enables -fsanitize=undefined for stage2 and stage3.
+
+STAGE2_CFLAGS += -fsanitize=undefined
+STAGE3_CFLAGS += -fsanitize=undefined
+POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
+ -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/
\
+
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ubsan] Add bootstrap-ubsan.mk
2013-07-30 14:42 [ubsan] Add bootstrap-ubsan.mk Marek Polacek
@ 2013-07-30 17:04 ` Marek Polacek
0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2013-07-30 17:04 UTC (permalink / raw)
To: GCC Patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-30 16:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 14:42 [ubsan] Add bootstrap-ubsan.mk Marek Polacek
2013-07-30 17:04 ` Marek Polacek
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).