Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
f46ffce4
Commit
f46ffce4
authored
Sep 17, 1992
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(parse_escape): Diagnose '\x' with no digits.
Diagnose integer overflow when parsing \x escapes. From-SVN: r2147
parent
0e14ddbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
gcc/cexp.y
+10
-5
No files found.
gcc/cexp.y
View file @
f46ffce4
...
...
@@ -803,23 +803,28 @@ parse_escape (string_ptr)
}
case 'x':
{
register
int i = 0
;
register
unsigned i = 0, overflow = 0, digits_found = 0, digit
;
for (;;)
{
c = *(*string_ptr)++;
if (c >= '0' && c <= '9')
i = (i << 4) +
c - '0';
digit =
c - '0';
else if (c >= 'a' && c <= 'f')
i = (i << 4) +
c - 'a' + 10;
digit =
c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
i = (i << 4) +
c - 'A' + 10;
digit =
c - 'A' + 10;
else
{
(*string_ptr)--;
break;
}
overflow |= i ^ (i << 4 >> 4);
i = (i << 4) + digit;
digits_found = 1;
}
if ((i & ~((1 << BITS_PER_UNIT) - 1)) != 0)
if (!digits_found)
yyerror ("\\x used with no following hex digits");
if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
{
i &= (1 << BITS_PER_UNIT) - 1;
warning ("hex character constant does not fit in a byte");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment