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