9ccffd1298
The preprocessor check for overflow (of linenum_type = unsigned int) when reading the line number in a #line directive is incomplete; it checks "reg < reg_prev" which doesn't cover all cases where multiplying by 10 overflowed. Fix this by checking for overflow before rather than after it occurs (using essentially the same logic as used by e.g. glibc printf when reading width and precision values from strings). Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * directives.c (strtolinenum): Check for overflow before it occurs. Correct comment. gcc/testsuite/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * gcc.dg/cpp/line9.c, gcc.dg/cpp/line10.c: New tests. |
||
---|---|---|
.. | ||
include | ||
po | ||
aclocal.m4 | ||
ChangeLog | ||
ChangeLog.jit | ||
charset.c | ||
config.in | ||
configure | ||
configure.ac | ||
directives.c | ||
errors.c | ||
expr.c | ||
files.c | ||
generated_cpp_wcwidth.h | ||
identifiers.c | ||
init.c | ||
internal.h | ||
lex.c | ||
line-map.c | ||
location-example.txt | ||
macro.c | ||
Makefile.in | ||
makeucnid.c | ||
mkdeps.c | ||
pch.c | ||
symtab.c | ||
system.h | ||
traditional.c | ||
ucnid.h | ||
ucnid.tab |