Commit 6da55c00 by Eric Christopher Committed by Eric Christopher

re PR preprocessor/19077 (Internal compiler error compiling MPlayer)

2005-02-15  Eric Christopher  <echristo@redhat.com>

	PR preprocessor/19077
	* macro.c (cpp_macro_definition): Move handling of whitespace
	to PREV_WHITE conditional. Remove overloading of len
	variable.

2005-02-15  Eric Christopher  <echristo@redhat.com>

	* gcc.dg/cpp/20050215-1.c: New file.

From-SVN: r95080
parent 6f85d0c4
2005-02-15 Eric Christopher <echristo@redhat.com>
* gcc.dg/cpp/20050215-1.c: New file.
2005-02-15 James A. Morrison <phython@gcc.gnu.org> 2005-02-15 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/15785 PR tree-optimization/15785
......
/* Testcase for memory corruption bug in macro processing.
See PR preprocessor/19077 for details. */
/* { dg-do compile } */
/* { dg-options "-g3" } */
#define FOO(a,b,c,d,e) a b c d e \
" " \
" " \
" "
int i;
2005-02-15 Eric Christopher <echristo@redhat.com>
PR preprocessor/19077
* macro.c (cpp_macro_definition): Move handling of whitespace
to PREV_WHITE conditional. Remove overloading of len
variable.
2005-02-14 Kazu Hirata <kazu@cs.umass.edu> 2005-02-14 Kazu Hirata <kazu@cs.umass.edu>
* directives.c, files.c, init.c, internal.h, macro.c, pch.c, * directives.c, files.c, init.c, internal.h, macro.c, pch.c,
......
...@@ -1666,6 +1666,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) ...@@ -1666,6 +1666,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
len += NODE_LEN (macro->params[i]) + 1; /* "," */ len += NODE_LEN (macro->params[i]) + 1; /* "," */
} }
/* This should match below where we fill in the buffer. */
if (CPP_OPTION (pfile, traditional)) if (CPP_OPTION (pfile, traditional))
len += _cpp_replacement_text_len (macro); len += _cpp_replacement_text_len (macro);
else else
...@@ -1677,11 +1678,14 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) ...@@ -1677,11 +1678,14 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
if (token->type == CPP_MACRO_ARG) if (token->type == CPP_MACRO_ARG)
len += NODE_LEN (macro->params[token->val.arg_no - 1]); len += NODE_LEN (macro->params[token->val.arg_no - 1]);
else else
len += cpp_token_len (token) + 1; /* Includes room for ' '. */ len += cpp_token_len (token);
if (token->flags & STRINGIFY_ARG) if (token->flags & STRINGIFY_ARG)
len++; /* "#" */ len++; /* "#" */
if (token->flags & PASTE_LEFT) if (token->flags & PASTE_LEFT)
len += 3; /* " ##" */ len += 3; /* " ##" */
if (token->flags & PREV_WHITE)
len++; /* " " */
} }
} }
...@@ -1741,10 +1745,10 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) ...@@ -1741,10 +1745,10 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
if (token->type == CPP_MACRO_ARG) if (token->type == CPP_MACRO_ARG)
{ {
len = NODE_LEN (macro->params[token->val.arg_no - 1]);
memcpy (buffer, memcpy (buffer,
NODE_NAME (macro->params[token->val.arg_no - 1]), len); NODE_NAME (macro->params[token->val.arg_no - 1]),
buffer += len; NODE_LEN (macro->params[token->val.arg_no - 1]));
buffer += NODE_LEN (macro->params[token->val.arg_no - 1]);
} }
else else
buffer = cpp_spell_token (pfile, token, buffer); buffer = cpp_spell_token (pfile, token, buffer);
......
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