------- Comment #8 from tromey at gcc dot gnu dot org  2006-12-27 21:43 -------
I looked at this a bit.

The basic problem resembles bug #14438 in a way.
The source code here has an unterminated "call" to a function-like
macro.  cpp thinks all the subsequent #define directives are
in the expansion (try -pedantic to see the errors).

I believe what happens is that during a call to create_iso_definition,
we call _cpp_lex_token at a point where it must allocate a new token
run.  But then upon returning we restore the old cur_token pointer
(see _cpp_create_definition), leading to the bug.

I'm testing a fix which works by saving and restoring cur_token in
lex_expansion_token.  I'm not positive this is correct, though.
Another possible fix might be to change create_iso_definition to call
_cpp_lex_direct rather than _cpp_lex_token.

BTW, my reading of _cpp_lex_token is that it assumes that cur_token
is in the current token run.  One easy way to make gdb stop when
the first bug is hit is to make a breakpoint conditional on this not
being true.  For debugging I added an assert() for this, but cpp
doesn't seem to use assertions anywhere, so I won't be submitting this.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-27 21:43:58
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29966

Reply via email to