https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70996
Bug ID: 70996 Summary: deadlock on compilation sequence of operator<< Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: magum1977 at gmail dot com Target Milestone: --- Created attachment 38434 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38434&action=edit compilation of this src is endless Code like below error() << "call() wrong id got:" << hex << (unsigned)op2() << " expect:" << (unsigned)op3() << '\n' << dec << " toSend op: " << (unsigned)op() << '\n' << " response msgid:" << (unsigned)op2() << '\n' << " response len: " << (unsigned)op3() << '\n' << " response op: " << op4() << '\n' << endl; with logger class which implement several overrided operator<< leads to infinite compilation. during infinite compilation cc1plus takes about 8% CPU. see src example in attach i compile it in c++98 mode with following options: g++ -pipe -c -msse2 -m64 -MD -Wno-trigraphs -Wno-multichar -Wformat -Wno-format-extra-args -ffunction-sections -fdata-sections -fno-omit-frame-pointer -ffast-math -ffinite-math-only -minline-all-stringops -std=c++98 -fconserve-space -Wno-invalid-offsetof -I /usr/include -g -fstack-protector -fexceptions -Wreturn-type -Werror -pthread -o message_port.o ../../prog/3rdPartyLibs/mongo-cxx-driver/mongo/util/net/message_port_test.cpp % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 6.1.1 20160501 (GCC)