This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]