summaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-19 17:43:38 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-19 17:43:38 +0000
commit6e95df84d1be816955443d07c4935189b0341c63 (patch)
treee2cba00ae190dd65b7a62f9ca7a997e8a14fee72 /gcc/cpphash.c
parent3326bbb948066c083ae0eb1e517ab59785bca263 (diff)
downloadgcc-6e95df84d1be816955443d07c4935189b0341c63.tar.gz
* cpphash.c (funlike_macroexpand): Make sure not to walk p1
past l1 when deleting whitespace and markers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34027 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index 3eb7d1a0e7a..39c97354499 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -1578,7 +1578,7 @@ funlike_macroexpand (pfile, hp, args)
{
/* Arg is concatenated before: delete leading whitespace,
whitespace markers, and no-reexpansion markers. */
- while (p1 != l1)
+ while (p1 < l1)
{
if (is_space(p1[0]))
p1++;
@@ -1592,7 +1592,7 @@ funlike_macroexpand (pfile, hp, args)
{
/* Arg is concatenated after: delete trailing whitespace,
whitespace markers, and no-reexpansion markers. */
- while (p1 != l1)
+ while (p1 < l1)
{
if (is_space(l1[-1]))
l1--;
@@ -1612,7 +1612,7 @@ funlike_macroexpand (pfile, hp, args)
/* Delete any no-reexpansion marker that precedes
an identifier at the beginning of the argument. */
- if (p1[0] == '\r' && p1[1] == '-')
+ if (p1 + 2 <= l1 && p1[0] == '\r' && p1[1] == '-')
p1 += 2;
memcpy (xbuf + totlen, p1, l1 - p1);