[Bug c++/87663] Exorbitant compile times

lumosimann at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 28 18:54:00 GMT 2018


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

--- Comment #5 from Lukas Mosimann <lumosimann at gmail dot com> ---
I was able to track down the error. The problem is caused due to
`set_underlying_type` in cfamily/c_common.c. I tried to disable that function
by simply returning on entry - and compilation times for cc1plus are completely
restored in all examples in this issue. This of course breaks other code, but
for the case of demonstration this is enough.
The first example with Version C used to compile in N=23: 181s, N=24: 493s,
N=25: 1348s. We would expect this to be a fibonacchi sequence - and this are
the new compile times for the same source: N=23: 5s, N=24: 8s, N=25: 13s.
Tests of  

Consider the example in the last comment. There the problem arises because the
variant list gets huge as this function adds type variants for the int-typedef
over and over. When looking for the right variant later, we need to iterate
over potentially all this variants.

Now I need your help: I don't know the code base for gcc that well. Why do we
need this functionality, and how could we solve this issue? I could imagine
that this can also impact real code - but it's hard to say because the
quick-fix above only works in simple codes. I would love to continue working on
this, but I need some hints how I could do this (or that it cannot be done
without major rework).


More information about the Gcc-bugs mailing list