gcc/libcpp
Joseph Myers 9ccffd1298 preprocessor: Fix #line overflow check [PR97602]
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.
2020-11-27 22:40:01 +00:00
..
include preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
po Daily bump. 2020-07-21 00:16:28 +00:00
ChangeLog Daily bump. 2020-11-25 09:34:01 +00:00
ChangeLog.jit
Makefile.in libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
aclocal.m4 libcpp: Enable Intel CET on Intel CET enabled host for jit 2020-05-12 09:17:45 -07:00
charset.c diagnostics: Support conversion of tabs to spaces [PR49973] [PR86904] 2020-07-14 12:05:56 -04:00
config.in
configure Require CET support only for the final GCC build 2020-07-30 05:36:24 -07:00
configure.ac libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
directives.c preprocessor: Fix #line overflow check [PR97602] 2020-11-27 22:40:01 +00:00
errors.c Update copyright years. 2020-01-01 12:51:42 +01:00
expr.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
files.c preprocessor: main file searching 2020-11-19 07:05:08 -08:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 13.0.0 2020-11-07 09:36:43 -05:00
identifiers.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
init.c preprocessor: main file searching 2020-11-19 07:05:08 -08:00
internal.h preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
lex.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
line-map.c preprocessor: module line maps 2020-11-17 08:10:56 -08:00
location-example.txt
macro.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
makeucnid.c Update copyright years. 2020-01-01 12:51:42 +01:00
mkdeps.c preprocessor: Update mkdeps for modules 2020-11-18 08:44:49 -08:00
pch.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
symtab.c Update copyright years. 2020-01-01 12:51:42 +01:00
system.h preprocessor: Random cleanups 2020-05-19 13:23:47 -07:00
traditional.c c: C2x __has_c_attribute 2020-11-12 21:13:51 +00:00
ucnid.h Update copyright years. 2020-01-01 12:51:42 +01:00
ucnid.tab Update copyright years. 2020-01-01 12:51:42 +01:00