[Bug c/89410] [7/8/9 Regression] ICE in calculate_line_spans, at diagnostic-show-locus.c:1237 after #line

segher at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 20 16:42:00 GMT 2019


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

--- Comment #8 from Segher Boessenkool <segher at gcc dot gnu.org> ---
The C standard does not allow the line number (in a #line directive) to be
smaller than 1 or bigger than 0x7fffffff.  It says nothing about actually
having this many lines, or overflowing the line number with following lines,
but I suppose we could disallow that as well.

As the ICEs show many parts of GCC assume line numbers increase, so the
wrap-around signed integer is a problem (it is anyway, it's UB in the compiler
itself).  We could make the line number saturate, but this particular ICE won't
go away unless line numbers are strictly increasing (or the code is changed).
Changing the type to 64 bit won't help at all either, of course (we never
actually see source files of 2G lines, already).


More information about the Gcc-bugs mailing list