[Mesa-dev] [PATCH 0/9] Enable gcc's undefined behaviour sanitizer
Michel Dänzer
michel at daenzer.net
Sat Apr 30 07:42:31 UTC 2016
On 30.04.2016 16:24, Nicolai Hähnle wrote:
> Hi,
>
> this patch series enables the use of gcc's -fsanitize=undefined in Mesa and
> fixes the bulk of reported issues in basic examples like glxgears. However,
> many issues remain, and some of them in the GLSL compiler look like they could
> be real - see below for a sampling.
>
> By "enables the use" I mean that (a) it fixes a compiler error that only
> happens with ubsan enabled, at least on gcc 5.3.1 and (b) it fixes a bunch
> of undefined behaviour (bad casts) that causes ubsan runs to crash with a
> segfault in the implementation of dynamic_cast.
>
> The bulk of the other fixes in this series are benign "left-shift into sign
> bit" fixes. In particular, that's what the giant gallium/radeon patch (7/9,
> probably too big for the mailing list) is about - that patch was generated
> mechanically.
>
> If you want to try this out yourself, you need to add -fsanitize=undefined
> to CFLAGS, CXXFLAGS, and LDFLAGS. You need a fairly recent libtool as well
> (the one that comes with Ubuntu 16.04 works for me, but I had to re-autogen),
> otherwise the option will be "helpfully" removed from the linker flags and
> linking will fail.
>
> You can find the entire series at https://cgit.freedesktop.org/~nh/mesa/log/?h=ubsan
> Please review!
Patches 1, 2, 6, 8 & 9 are
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the mesa-dev
mailing list