https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89494
--- Comment #12 from Piotr Kubaj <pkubaj at anongoth dot pl> --- This issue can be fixed with the following patches: --- gcc/dumpfile.c.orig 2020-04-07 14:09:14 UTC +++ gcc/dumpfile.c @@ -2055,7 +2055,7 @@ temp_dump_context::temp_dump_context (bool forcibly_en bool forcibly_enable_dumping, dump_flags_t test_pp_flags) : m_context (), - m_saved (&dump_context ().get ()) + m_saved(&dump_context::get()) { dump_context::s_current = &m_context; if (forcibly_enable_optinfo) --- libgcc/config/rs6000/t-crtstuff.orig 2020-04-07 15:17:50 UTC +++ libgcc/config/rs6000/t-crtstuff @@ -3,4 +3,4 @@ # Do not build crtend.o with -Os as that can result in references to # out-of-line register save/restore functions, which may be unresolved # as crtend.o is linked after libgcc.a. See PR45053. -CRTSTUFF_T_CFLAGS = -msdata=none -O2 -fno-asynchronous-unwind-tables +CRTSTUFF_T_CFLAGS = -msdata=none -O0 -fno-asynchronous-unwind-tables --- Makefile.in.orig 2020-04-08 13:04:40 UTC +++ Makefile.in @@ -372,7 +372,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # Flags to pass to stage2 and later makes. They are defined # here so that they can be overridden by Makefile fragments. -BOOT_CFLAGS= -g -O2 +BOOT_CFLAGS?= -g -O2 BOOT_LDFLAGS= BOOT_ADAFLAGS= -gnatpg And then you need to pass to configure and make the following env variables CFLAGS_FOR_TARGET="-O0" CXXFLAGS_FOR_TARGET="-O0" BOOT_CFLAGS="-O0". The first patch is already sent by Gustavo Romero from IBM to GCC patches list. GCC10 needs further fixing, unfortunately.