https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89494
--- Comment #7 from Piotr Kubaj <pkubaj at anongoth dot pl> --- It still crashes (test was done with 7.4.0), but we're getting somewhere. It crashes at: libtool: compile: /usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/xgcc -shared-libgcc -B/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc -nostdinc++ -L/usr/local/poudriere/ports/default/lang/gcc7/work/.build/powerpc64-portbld-freebsd12.0/libstdc++-v3/src -L/usr/local/poudriere/ports/default/lang/gcc7/work/.build/powerpc64-portbld-freebsd12.0/libstdc++-v3/src/.libs -L/usr/local/poudriere/ports/default/lang/gcc7/work/.build/powerpc64-portbld-freebsd12.0/libstdc++-v3/libsupc++/.libs -B/usr/local/powerpc64-portbld-freebsd12.0/bin/ -B/usr/local/powerpc64-portbld-freebsd12.0/lib/ -isystem /usr/local/powerpc64-portbld-freebsd12.0/include -isystem /usr/local/powerpc64-portbld-freebsd12.0/sys-include -I/usr/local/poudriere/ports/default/lang/gcc7/work/gcc-7.4.0/libstdc++-v3/../libgcc -I/usr/local/poudriere/ports/default/lang/gcc7/work/.build/powerpc64-portbld-freebsd12.0/libstdc++-v3/include/powerpc64-portbld-freebsd12.0 -I/usr/local/poudriere/ports/default/lang/gcc7/work/.build/powerpc64-portbld-freebsd12.0/libstdc++-v3/include -I/usr/local/poudriere/ports/default/lang/gcc7/work/gcc-7.4.0/libstdc++-v3/libsupc++ -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=class_type_info.lo -g -O2 -pipe -DLIBICONV_PLUG -c /usr/local/poudriere/ports/default/lang/gcc7/work/gcc-7.4.0/libstdc++-v3/libsupc++/class_type_info.cc -fPIC -DPIC -D_GLIBCXX_SHARED -o class_type_info.o /usr/local/poudriere/ports/default/lang/gcc7/work/gcc-7.4.0/libstdc++-v3/libsupc++/class_type_info.cc: In member function 'virtual bool __cxxabiv1::__class_type_info::__do_upcast(const __cxxabiv1::__class_type_info*, void**) const': /usr/local/poudriere/ports/default/lang/gcc7/work/gcc-7.4.0/libstdc++-v3/libsupc++/class_type_info.cc:45:6: internal compiler error: Segmentation fault bool __class_type_info:: ^~~~~~~~~~~~~~~~~ Interestingly, I can see -O0 added to flags before: gmake "AR_FLAGS=rc" "CC_FOR_BUILD=cc" "CC_FOR_TARGET=/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/xgcc -B/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/" "CFLAGS=-O0" "CXXFLAGS=-g -O2 -pipe -DLIBICONV_PLUG " "CFLAGS_FOR_BUILD=-O0" "CFLAGS_FOR_TARGET=-O0" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=install -m 0644" "INSTALL_PROGRAM=install -s -m 555" "INSTALL_SCRIPT=install -m 555" "LDFLAGS=" "LIBCFLAGS=-O0" "LIBCFLAGS_FOR_TARGET=-O0" "MAKE=gmake" "MAKEINFO=makeinfo --no-split --split-size=5000000 --split-size=5000000 --split-size=5000000" "SHELL=/bin/sh" "RUNTESTFLAGS=" "exec_prefix=/usr/local" "infodir=/usr/local/share/info/gcc7" "libdir=/usr/local/lib/gcc7" "includedir=/usr/local/include" "prefix=/usr/local" "tooldir=/usr/local/powerpc64-portbld-freebsd12.0" "gxx_include_dir=/usr/local/lib/gcc7/include/c++/" "AR=/usr/local/powerpc64-portbld-freebsd12.0/bin/ar" "AS=/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/as" "LD=/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/collect-ld" "RANLIB=/usr/local/powerpc64-portbld-freebsd12.0/bin/ranlib" "NM=/usr/local/poudriere/ports/default/lang/gcc7/work/.build/./gcc/nm" "NM_FOR_BUILD=" "NM_FOR_TARGET=/usr/local/powerpc64-portbld-freebsd12.0/bin/nm" "DESTDIR=" "WERROR=" all-recursive But the failing command is run strictly with -O2. If I just cd to '/usr/local/poudriere/ports/default/lang/gcc7/work/.build/libiberty' and run it manually, but change -O2 to -O0, it passes. I can't find how to change -O level globally. I currently set BOOT_CFLAGS="-O0" CFLAGS_FOR_TARGET="-O0" CFLAGS_FOR_BUILD="-O0" STAGE_CFLAGS="-O0" STAGE2_CXXFLAGS="-O0" STAGE2_CFLAGS="-O0" STAGE1_CXXFLAGS="-O0" STAGE1_CFLAGS="-O0" and it looks like some files are compiled with -O0, but some commands still use -O2 (like the one above). How can I set it to add -O0 everywhere?