Commit 7da73ba7 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/89495 (gcc/c-family/c-format.c:1272:20: runtime error: signed integer…

re PR c/89495 (gcc/c-family/c-format.c:1272:20: runtime error: signed integer overflow: 214748365 * 10 cannot be represented in type 'int')

	PR c/89495
	* c-format.c (maybe_read_dollar_number): Compute nargnum in
	HOST_WIDE_INT type to avoid overflows and change overflow_flag
	checking.

From-SVN: r269198
parent 79695450
2019-02-25 Jakub Jelinek <jakub@redhat.com>
PR c/89495
* c-format.c (maybe_read_dollar_number): Compute nargnum in
HOST_WIDE_INT type to avoid overflows and change overflow_flag
checking.
2019-02-22 Richard Biener <rguenther@suse.de> 2019-02-22 Richard Biener <rguenther@suse.de>
* c-pch.c (no_checksum): Remove. * c-pch.c (no_checksum): Remove.
......
...@@ -1268,9 +1268,9 @@ maybe_read_dollar_number (const char **format, ...@@ -1268,9 +1268,9 @@ maybe_read_dollar_number (const char **format,
overflow_flag = 0; overflow_flag = 0;
while (ISDIGIT (*fcp)) while (ISDIGIT (*fcp))
{ {
int nargnum; HOST_WIDE_INT nargnum
nargnum = 10 * argnum + (*fcp - '0'); = HOST_WIDE_INT_UC (10) * argnum + (*fcp - '0');
if (nargnum < 0 || nargnum / 10 != argnum) if ((int) nargnum != nargnum)
overflow_flag = 1; overflow_flag = 1;
argnum = nargnum; argnum = nargnum;
fcp++; fcp++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment