https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95264

            Bug ID: 95264
           Summary: Infinite Loop When Compiling Templated C++ code at -O1
                    and above
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: freddie at witherden dot org
  Target Milestone: ---

Created attachment 48578
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48578&action=edit
Preprocessed source.

When attempting to compile the header-only C++ application Polyquad
(https://github.com/PyFR/Polyquad) with any recent version of GCC at any
optimization level, the compiler gets stuck.  (And either dies with c++: fatal
error: Killed signal terminated program cc1plus or an out of memory error
depending on the platform.)

This is believed to be an interaction between the Boost bfloat type (an
arbitrary precision numerical type) and the Eigen library (a heavily templated
matrix library).

By comparison, Clang is able to compile the application in a few minutes at any
optimization level with memory never peaking above 3-4 GiB.  GCC with -O3 -g
will happily malloc in excess of 30 GiB before dying (although this can be
curtailed somewhat by -fno-var-tracking-assignments).

The compiler command (from the uncompressed pre-processed source) is:

/usr/libexec/gcc/x86_64-pc-linux-gnu/10.1.0/cc1plus -fpreprocessed main.ii
-march=skylake -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16
-msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4
-mno-xop -mbmi -msgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2
-msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mrdseed
-mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er
-mno-avx512cd -mno-avx512pf -mno-prefetchwt1-mclflushopt -mxsavec -mxsaves
-mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
-mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku
-mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes
-mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg
-mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect
--param l1-cache-size=32 --param l1-cache-line-size=64 --param
l2-cache-size=6144-mtune=skylake -quiet -dumpbase main.cpp -auxbase-strip
CMakeFiles/polyquad.dir/src/main.cpp.o -O3 -Wno-deprecated -std=c++17 -version
-fno-var-tracking-assignments-o main.s

Reply via email to