public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98980] New: Very slow compilation with -Wduplicated-branches and ubsan
@ 2021-02-05 23:59 sshannin at gmail dot com
  2021-02-06  0:05 ` [Bug c++/98980] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: sshannin at gmail dot com @ 2021-02-05 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98980
           Summary: Very slow compilation with -Wduplicated-branches and
                    ubsan
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sshannin at gmail dot com
  Target Milestone: ---

Created attachment 50136
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50136&action=edit
the code

I have attached a heavily reduced example which encounters excessively slow
compilation.  I was not able to remove the stringstream include without the
degenerate behavior disappearing, unfortunately; I hope that's ok.

It seems to be mostly exponential in the number of operator<< invocations, with
a couple interesting behaviors
- s/long/int/g on the code allows it to compile almost instantly
- removing any of the longs being streamed seems to halve the time, but so does
replacing the variable with a literal
- removing any of the string literals also halves the time.

Compiled with flags:
/toolchain14/bin/g++ -std=c++2a -Wduplicated-branches -c -fsanitize=undefined
-o dup.o dup.cpp

/toolchain14/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/toolchain14/bin/g++
COLLECT_LTO_WRAPPER=/toolchain14/libexec/gcc/x86_64-pc-linux-gnu/9.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc_9_1_0/configure --prefix=/toolchain14
--enable-languages=c,c++,fortran --enable-lto --disable-plugin
--program-suffix=-9.1.0 --disable-multilib
Thread model: posix
gcc version 9.1.0 (GCC)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/98980] Very slow compilation with -Wduplicated-branches and ubsan
  2021-02-05 23:59 [Bug c++/98980] New: Very slow compilation with -Wduplicated-branches and ubsan sshannin at gmail dot com
@ 2021-02-06  0:05 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-02-06  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 82952 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-06  0:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 23:59 [Bug c++/98980] New: Very slow compilation with -Wduplicated-branches and ubsan sshannin at gmail dot com
2021-02-06  0:05 ` [Bug c++/98980] " mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).