https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67496
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- I finally managed to build gcc with -fsanitize=undefined: Using built-in specs. COLLECT_GCC=gfcg COLLECT_LTO_WRAPPER=/opt/gcc/gcc7g/libexec/gcc/x86_64-apple-darwin15.4.0/7.0.0/lto-wrapper Target: x86_64-apple-darwin15.4.0 Configured with: ../work/configure --prefix=/opt/gcc/gcc7g --enable-languages=c,c++,fortran --with-gmp=/opt/mp-new --with-system-zlib --with-isl=/opt/mp-new --disable-bootstrap --disable-multilib --disable-libstdcxx CFLAGS='-L/opt/gcc/gcc7a/lib -lubsan -fsanitize=undefined -Og -g -fno-omit-frame-pointer' CXXFLAGS='-fsanitize=undefined -Og -g -fno-omit-frame-pointer' LDFLAGS='-L/opt/gcc/gcc7a/lib -lubsan -ldl -lpthread' : (reconfigured) ../work/configure --prefix=/opt/gcc/gcc7g --with-gmp=/opt/mp-new --with-system-zlib --with-isl=/opt/mp-new --disable-bootstrap --disable-multilib --disable-libstdcxx CFLAGS='-L/opt/gcc/gcc7a/lib -lubsan -fsanitize=undefined -Og -g -fno-omit-frame-pointer' CXXFLAGS='-fsanitize=undefined -Og -g -fno-omit-frame-pointer' LDFLAGS='-L/opt/gcc/gcc7a/lib -lubsan -ldl -lpthread' --enable-languages=c,c++,fortran --no-create --no-recursion Thread model: posix gcc version 7.0.0 20160430 (experimental) [trunk revision 235678p25] (GCC) where gcc7a is Using built-in specs. COLLECT_GCC=gfca COLLECT_LTO_WRAPPER=/opt/gcc/gcc7a/libexec/gcc/x86_64-apple-darwin15.4.0/7.0.0/lto-wrapper Target: x86_64-apple-darwin15.4.0 Configured with: ../_clean/configure --prefix=/opt/gcc/gcc7a --enable-languages=c,c++,fortran,ada,lto --with-gmp=/opt/mp-new --with-system-zlib --enable-checking=release --with-isl=/opt/mp-new --enable-lto --enable-plugin Thread model: posix gcc version 7.0.0 20160429 (experimental) [trunk revision 235619] (GCC) I have tried several variants of typespec_chararray_ctor = (expr->ts.u.cl && expr->ts.u.cl->length_from_typespec); without any progress. Are we sure that the problem is in gfortran and not in ubsan?