From b7150e45977639889fad84cc279a8ae2dff5d28e Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 11 Aug 1994 16:41:33 -0400 Subject: [PATCH] (rescan): Fix botches with `-lint': the output buffer pointer was not recached properly, leading to lost output. (rescan): Fix botches with `-lint': the output buffer pointer was not recached properly, leading to lost output. Also, buffer overrun was possible. From-SVN: r7896 --- gcc/cccp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index 1a9f6603f4e..65e2d8f5683 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -2797,6 +2797,9 @@ do { ip = &instack[indepth]; \ char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen); if (lintcmd != NULL) { + op->bufp = obp; + check_expand (op, 13 + cmdlen); + obp = op->bufp; /* I believe it is always safe to emit this newline: */ obp[-1] = '\n'; bcopy ("#pragma lint ", (char *) obp, 13); @@ -2811,10 +2814,12 @@ do { ip = &instack[indepth]; \ } /* OK, now bring us back to the state we were in before we entered - this branch. We need #line b/c the newline for the pragma - could fuck things up. */ + this branch. We need #line because the #pragma's newline always + messes up the line count. */ + op->bufp = obp; output_line_command (ip, op, 0, same_file); - *(obp++) = ' '; /* just in case, if comments are copied thru */ + check_expand (op, ip->length - (ip->bufp - ip->buf)); + obp = op->bufp; *(obp++) = '/'; } } -- 2.30.2