Commit 45e0984c by Dave Brolley Committed by Dave Brolley

c-lex.c (yylex): Fix boundary conditions in character literal and string literal loops.

Mon Jul 27 14:22:36 1998  Dave Brolley  <brolley@cygnus.com>
	* c-lex.c (yylex): Fix boundary conditions in character literal and
	string literal loops.

From-SVN: r21413
parent ea6c1142
Mon Jul 27 14:22:36 1998 Dave Brolley <brolley@cygnus.com>
* c-lex.c (yylex): Fix boundary conditions in character literal and
string literal loops.
Mon Jul 27 11:43:54 1998 Stan Cox <scox@cygnus.com> Mon Jul 27 11:43:54 1998 Stan Cox <scox@cygnus.com>
* longlong.h (count_leading_zeros): Sparclite scan instruction was * longlong.h (count_leading_zeros): Sparclite scan instruction was
......
...@@ -1994,7 +1994,7 @@ yylex () ...@@ -1994,7 +1994,7 @@ yylex ()
int char_len = -1; int char_len = -1;
for (i = 0; i < longest_char; ++i) for (i = 0; i < longest_char; ++i)
{ {
if (p + i == token_buffer + maxtoken) if (p + i >= token_buffer + maxtoken)
p = extend_token_buffer (p); p = extend_token_buffer (p);
p[i] = c; p[i] = c;
...@@ -2031,7 +2031,7 @@ yylex () ...@@ -2031,7 +2031,7 @@ yylex ()
unsigned bytemask = (1 << width) - 1; unsigned bytemask = (1 << width) - 1;
int byte; int byte;
if (p + WCHAR_BYTES >= token_buffer + maxtoken) if (p + WCHAR_BYTES > token_buffer + maxtoken)
p = extend_token_buffer (p); p = extend_token_buffer (p);
for (byte = 0; byte < WCHAR_BYTES; ++byte) for (byte = 0; byte < WCHAR_BYTES; ++byte)
...@@ -2050,7 +2050,7 @@ yylex () ...@@ -2050,7 +2050,7 @@ yylex ()
} }
else else
{ {
if (p == token_buffer + maxtoken) if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p); p = extend_token_buffer (p);
*p++ = c; *p++ = c;
} }
...@@ -2063,14 +2063,14 @@ yylex () ...@@ -2063,14 +2063,14 @@ yylex ()
or with a wide zero. */ or with a wide zero. */
if (wide_flag) if (wide_flag)
{ {
if (p + WCHAR_BYTES >= token_buffer + maxtoken) if (p + WCHAR_BYTES > token_buffer + maxtoken)
p = extend_token_buffer (p); p = extend_token_buffer (p);
bzero (p, WCHAR_BYTES); bzero (p, WCHAR_BYTES);
p += WCHAR_BYTES; p += WCHAR_BYTES;
} }
else else
{ {
if (p == token_buffer + maxtoken) if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p); p = extend_token_buffer (p);
*p++ = 0; *p++ = 0;
} }
......
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