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
This commit is contained in:
parent
7969545012
commit
7da73ba7ef
2 changed files with 10 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
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>
|
||||
|
||||
* c-pch.c (no_checksum): Remove.
|
||||
|
|
|
@ -1268,9 +1268,9 @@ maybe_read_dollar_number (const char **format,
|
|||
overflow_flag = 0;
|
||||
while (ISDIGIT (*fcp))
|
||||
{
|
||||
int nargnum;
|
||||
nargnum = 10 * argnum + (*fcp - '0');
|
||||
if (nargnum < 0 || nargnum / 10 != argnum)
|
||||
HOST_WIDE_INT nargnum
|
||||
= HOST_WIDE_INT_UC (10) * argnum + (*fcp - '0');
|
||||
if ((int) nargnum != nargnum)
|
||||
overflow_flag = 1;
|
||||
argnum = nargnum;
|
||||
fcp++;
|
||||
|
|
Loading…
Add table
Reference in a new issue