diff options
author | Richard Stallman <rms@gnu.org> | 1992-08-01 18:07:21 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-08-01 18:07:21 +0000 |
commit | 88dd95c1c02029e682ed32d94452a21eac8c559a (patch) | |
tree | a3ed2268a5d811533b08c365a683b8404d950a49 /gcc/c-lex.c | |
parent | aaf5be8b9371abd0e1a1190424967f92417bb62b (diff) | |
download | gcc-88dd95c1c02029e682ed32d94452a21eac8c559a.zip gcc-88dd95c1c02029e682ed32d94452a21eac8c559a.tar.gz gcc-88dd95c1c02029e682ed32d94452a21eac8c559a.tar.bz2 |
(yylex): When traditional, convert 0x80000000 to -0x80000000.
From-SVN: r1738
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 0afcc91..fdd2014 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1577,7 +1577,17 @@ yylex () && !warn) pedwarn ("integer constant out of range"); - TREE_TYPE (yylval.ttype) = type; + if (flag_traditional && !int_fits_type_p (yylval.ttype, type)) + /* The traditional constant 0x80000000 is signed + but doesn't fit in the range of int. + This will change it to -0x80000000, which does fit. */ + { + TREE_TYPE (yylval.ttype) = unsigned_type (type); + yylval.ttype = convert (type, yylval.ttype); + } + else + TREE_TYPE (yylval.ttype) = type; + *p = 0; } |