develooper Front page | perl.perl5.porters | Postings from March 2013

It looks like a serious bug in the z/OS C preprocessor

Thread Next
From:
Karl Williamson
Date:
March 2, 2013 04:33
Subject:
It looks like a serious bug in the z/OS C preprocessor
Message ID:
513180FF.4070306@khwilliamson.com
John sent me a bunch of output.  I chose to look at util.c because its 
relatively short.  After deleting all the __inline__ warnings, there 
were just two left:
ERROR CCN3277 ./util.c.c:23818 Syntax error: possible missing ';' or ','?
ERROR CCN3277 ./util.c.c:23819 Syntax error: possible missing ';' or ','?

The util.c.c file is what is generated by the preprocessor.  The 
shortest of the errors is line 23819:

*(*dest)++ = ((PL_e2a[(U8)(byte)] & ((U8)0x1f)) | 0xA0) 
PL_utf2e[(U8)((PL_e2a[(U8)(byte)] & ((U8)0x1f)) | 0xA0)];


And yes there is a syntax error there.  If you look at the balanced 
parens, you will note that the first set ends in the middle of the line, 
and then there is a space and then a PL_utf2e[...];  The latter is a 
complete subexpression going to the end of the line.

So there are two expressions separated by a blank, indeed a syntax 
error.  If you look carefully, that first expression is repeated as a 
component of the 2nd.  It turns out that the correct expansion of the 
macro is just the 2nd expression.  The 1st expression should not be 
there.  The preprocessor is apparently outputting the results of an 
intermediate stage of its processing!

I wonder if some developer left in a debug statement in the 
preprocessor.  But surely it gets enough use that this would have been 
exposed long before now.  So I don't know how to proceed.  (Note that 
this bug would cause huge long expansions when shorter ones would be 
correct; if fixed, exceeding the apparent 2048 character limit might 
just go away.)

I'm sending this to the whole list in case it rings a bell for someone.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About