c-lex.c (yylex): Fix boundary conditions in character literal and string literal...
authorDave Brolley <brolley@cygnus.com>
Mon, 27 Jul 1998 12:37:16 +0000 (12:37 +0000)
committerDave Brolley <brolley@gcc.gnu.org>
Mon, 27 Jul 1998 12:37:16 +0000 (08:37 -0400)
1998-07-27  Dave Brolley  <brolley@cygnus.com>
* c-lex.c (yylex): Fix boundary conditions in character literal and
string literal loops.

From-SVN: r21412

gcc/cp/ChangeLog
gcc/cp/lex.c

index c44d18a9627cafa1e4a69effe4cd23355eb9df0b..d707577883fd9fc1472e9745e0246a0187ddf024 100644 (file)
@@ -1,3 +1,8 @@
+1998-07-27  Dave Brolley  <brolley@cygnus.com>
+
+       * c-lex.c (yylex): Fix boundary conditions in character literal and
+       string literal loops.
+
 1998-07-24  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (lookup_name_real): OK, do return the from_obj value
index 5ef7f1d29c84b49a9e2e3b270f20b748e7075639..d127ddceed283d874daec67e268e6ac13154837e 100644 (file)
@@ -4132,7 +4132,7 @@ real_yylex ()
                int char_len = -1;
                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[i] = c;
 
@@ -4169,7 +4169,7 @@ real_yylex ()
                unsigned bytemask = (1 << width) - 1;
                int byte;
 
-               if (p + WCHAR_BYTES >= token_buffer + maxtoken)
+               if (p + WCHAR_BYTES > token_buffer + maxtoken)
                  p = extend_token_buffer (p);
 
                for (byte = 0; byte < WCHAR_BYTES; ++byte)
@@ -4188,7 +4188,7 @@ real_yylex ()
              }
            else
              {
-               if (p == token_buffer + maxtoken)
+               if (p >= token_buffer + maxtoken)
                  p = extend_token_buffer (p);
                *p++ = c;
              }
@@ -4205,14 +4205,14 @@ real_yylex ()
           or with a wide zero.  */
        if (wide_flag)
          {
-           if (p + WCHAR_BYTES >= token_buffer + maxtoken)
+           if (p + WCHAR_BYTES > token_buffer + maxtoken)
              p = extend_token_buffer (p);
            bzero (p, WCHAR_BYTES);
            p += WCHAR_BYTES;
          }
        else
          {
-           if (p == token_buffer + maxtoken)
+           if (p >= token_buffer + maxtoken)
              p = extend_token_buffer (p);
            *p++ = 0;
          }