[Bug c/89569] line number is not accurate on large file with more than UINT32_MAX actual lines

jg at jguk dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 13 06:20:00 GMT 2019


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

--- Comment #3 from Jonny Grant <jg at jguk dot org> ---
(In reply to Jonathan Wakely from comment #2)
> Why would 3 be the expected value? Line numbers are natural numbers, not
> uint32.

Yes, you're right. if the behaviour was defined to be the same as clang, it
would wrap a uint32. Anyway, better it just use uint64.

line 0 is never a valid line, so if it goes above the limit for the type, maybe
just fix it on 0?

Oddly "#line 0" is also still not rejected by GCC. As I understand it, "#line
n" sets the next line's number. So zero would never be valid.


More information about the Gcc-bugs mailing list