https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67540
--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> --- On the same line CFLAGS="-fsanitize=undefined -Og -g -fno-omit-frame-pointer" CXXFLAGS=$CFLAGS LDFLAGS="-lubsan -ldl -lpthread" /home/vitti/gcc-5.2.0/configure --prefix=/home/vitti/1tb/local/gcc-5.2.0-undefined --disable-bootstrap --enable-languages=c,ada,c++,fortran,go,lto,objc,obj-c++ --no-create --no-recursion : (reconfigured) /home/vitti/gcc-5.2.0/configure --prefix=/home/vitti/1tb/local/gcc-5.2.0-undefined --disable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto Then "make" but it is not that easy, I had to tweak and modify some configure files to keep going and libtool as well. But I made it. I even got a -fsanitize=address version working. BTW can you confirm that the test case is erroneous because it dereferences a NULL pointer? Is that intended?