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

--- Comment #5 from Thomas Kieß <Thomas.Kiess at vector dot com> ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Jonathan Wakely from comment #2)
> > (In reply to Thomas Kieß from comment #0)
> > > the current implementation limits overview
> > > (https://gcc.gnu.org/onlinedocs/gcc-14.2.0/cpp/Implementation-limits.html)
> > 
> > N.B. this page is for cpp the C preprocessor, not for C++.
> 
> That's why it only lists things like the number of nested includes and other
> limits relevant to preprocessing.
> 
> I don't think there's an equivalent page for the C++ compiler, but I don't
> think there are any set limits for any of the other quantities. They are
> limited only by available memory, but as I said, in practice you'll probably
> encounter unacceptably slow compile times on modern machines with multiple
> gigabytes of memory available. Some algorithms within the compiler are
> quadratic or worse, so when dealing with ridiculously complicated
> expressions, source files, or numbers of data members in a struct,
> performance may slow to a crawl even before memory is exhausted.
> 
> If you encounter practical limits, please report them as bugs with one of
> the keywords "compile-time-hog" or "memory-hog".

Thanks for your feedback. 

The motivation of my question is that as a user I currently don't know what
will happen when one of the limits is violated. 

Does that only lead to long compile times, maybe a crash or (worst) to
undefined behavior in the resulting binary. 

Currently, static analysis tools that report issues for "ISO C++ violation" can
only use the limits provided by the C++ standard as reference and that does not
help much.

Therefore, I think that all that have to work with AUTOSAR C++14, MISRA C/C++,
or care about security or safety would appreciate if the official documentation
would (at some location) explicitly state what happens when the language
standard limits are violated or what happens when the GCC limits are reached.
  • [Bug c++/117308] Undocumented ... Thomas.Kiess at vector dot com via Gcc-bugs

Reply via email to