This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: mem stomp in cpplib.c?
- To: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Subject: Re: mem stomp in cpplib.c?
- From: Neil Booth <NeilB at earthling dot net>
- Date: Thu, 6 Jul 2000 18:51:55 +0900
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>
- References: <20000705102250.T22747@rjlhome.sco.com> <20000705093535.A284@wolery.cumb.org> <E139xib-0006Oz-00@monkey.rosenet.ne.jp>
bash-2.04$ cat ~/bug.c
#assert test(answer)
#if #tesz(answer)
#error Not all chars significant!
#endif
bash-2.04$ ./cpp ~/bug.c
# 1 "/home/neil/bug.c"
/home/neil/bug.c:3:2: #error Not all chars significant!
I've committed the following patch as an obvious fix. I'll add a
test case in the next batch of test cases.
Neil.
* cpplib.c: (_cpp_parse_assertion): Perform hash lookups
based on full length of predicate.
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.c,v
retrieving revision 1.182
diff -u -p -r1.182 cpplib.c
--- cpplib.c 2000/07/05 18:12:42 1.182
+++ cpplib.c 2000/07/06 09:48:08
@@ -1328,7 +1328,7 @@ _cpp_parse_assertion (pfile, answerp)
/* Prefix '#' to get it out of macro namespace. */
sym[0] = '#';
memcpy (sym + 1, predicate->val.name.text, len);
- return cpp_lookup (pfile, sym, len);
+ return cpp_lookup (pfile, sym, len + 1);
error:
FREE_ANSWER (answer);