gcc -E -traditional broken
Zack Weinberg
zackw@Stanford.EDU
Mon Dec 11 14:54:00 GMT 2000
On Mon, Dec 11, 2000 at 10:40:40PM +0000, Neil Booth wrote:
> Zack Weinberg wrote:-
>
> > That might do it, but I was avoiding work last night and fixed it
> > another way. See what you think of this. (Please pick up the test
> > cases even if you don't want the patch.)
>
> The NUL errors just happened to show up for defined (they've only been
> there for about 3 days); they occur throughout tradcpp.c so I'd rather
> keep my patch. I got segfaults with __INCLUDE_LEVEL__ when I was
> trying to figure out what was causing it.
As long as you're sure that that's sufficient. The code path I saw it
going through was like this:
rescan sees 'defined'
rescan calls macroexpand
macroexpand calls special_symbol
special_symbol advances past '[(] macroname [)]'
and inserts " 0 " or " 1 " into the output
macroexpand returns without stacking a new buffer
rescan assumes that if macroexpand didn't stack a new buffer,
it didn't move ibp either, so it need not recheck
against limit
rescan walks past the end of the buffer.
However, rescan is a steaming pile of spaghetti, and it may well be
that taking NUL out of its is_nvspace causes it to go a different
way.
> I'll do your testcases soon.
I just discovered that tradcpp silently ignores #error, which means
that tr-defined.c can give false passes. On the #assert argument, it
probably makes sense to add #error to tradcpp; this should be
relatively easy.
zw
More information about the Gcc-bugs
mailing list