https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65039
Bug ID: 65039 Summary: g++ 5 segmentation fault when compiling with -O2 optimization Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: truckman at FreeBSD dot org Created attachment 34739 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34739&action=edit preprocessed c++ source that triggers g++ segmentation fault when compiling with -O2 # g++5 -v Using built-in specs. COLLECT_GCC=g++5 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.0.0/lto-wrapper Target: x86_64-portbld-freebsd10.1 Configured with: ./../gcc-5-20150208/configure --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc5 --libexecdir=/usr/local/libexec/gcc5 --program-suffix=5 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc5/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --with-ecj-jar=/usr/local/share/java/ecj-4.5.jar --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc5 --build=x86_64-portbld-freebsd10.1 Thread model: posix gcc version 5.0.0 20150208 (experimental) (FreeBSD Ports Collection) g++ is getting a segmentation fault when compiling a particular c++ file with -O2 optimization. Compiling with -O0 or -O1 is successful. Fails: # g++5 -std=c++11 -fmessage-length=0 -c -O2 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -g1 -Wall -Wextra -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-unused-local-typedefs -fpic -fexceptions -fno-enforce-eh-specs -o _serviceregistration_controller.o _serviceregistration_controller.ii /wrkdirs/usr/ports/editors/openoffice-4/work/aoo-4.1.1/main/chart2/source/controller/main/_serviceregistration_controller.cxx:113:1: internal compiler error: Segmentation fault } ^ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. Succeeds: # g++5 -std=c++11 -fmessage-length=0 -c -O1 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -g1 -Wall -Wextra -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-unused-local-typedefs -fpic -fexceptions -fno-enforce-eh-specs -o _serviceregistration_controller.o _serviceregistration_controller.ii #