This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix off-by-one error
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 May 2002 20:22:13 +0100
- Subject: Fix off-by-one error
This is PR preprocessor/6844. It doesn't exist in 3.0; it
must have been introduced in the changes during 3.1 to output
macro definitions properly for DWARF2.
I'll apply this to 3.1 and 3.2.
Neil.
PR preprocessor/6844
* cppmacro.c (cpp_macro_definition): Reserve space for terminating
NUL.
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.91.6.5
diff -u -p -r1.91.6.5 cppmacro.c
--- cppmacro.c 24 May 2002 19:13:37 -0000 1.91.6.5
+++ cppmacro.c 29 May 2002 18:28:04 -0000
@@ -1531,7 +1531,7 @@ cpp_macro_definition (pfile, node)
}
/* Calculate length. */
- len = NODE_LEN (node) + 1; /* ' ' */
+ len = NODE_LEN (node) + 2; /* ' ' and NUL. */
if (macro->fun_like)
{
len += 4; /* "()" plus possible final ".." of named