https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80318
Bug ID: 80318 Summary: GCC takes too much RAM and time compiling a template file Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: benjamin.redelings at gmail dot com Target Milestone: --- Hi, When compiling the attached file, GCC takes 2 minutes and about 6 gigs of RAM. This is large compared to clang, which takes about 55 second and about 1.8 gigs of RAM. Here's the exactly compilation command: g++-7 -std=c++14 -DHAVE_CONFIG_H -I. -I../../../master/src -I.. -I../../../master/include -I../../../master/src -isystem ../../../master/boost/include -ffast-math -DNDEBUG -DNDEBUG_DP -funroll-loops -Wall -Wextra -Wno-sign-compare -Woverloaded-virtual -Wstrict-aliasing -pipe -O3 -pedantic -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -g -Wmisleading-indentation -Wlogical-op -MT parser/parse.o -MD -MP -MF $depbase.Tpo -c -o parser/parse.o ../../../master/src/parser/parse.C I've attached the preprocessed source below. GCC version is. $ g++-7 -v Using built-in specs. COLLECT_GCC=g++-7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 7-20170316-1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.0.1 20170316 (experimental) [trunk revision 246203] (Debian 7-20170316-1)