develooper Front page | perl.perl5.porters | Postings from September 2016

Re: [perl #129196] Segmentation fault: "evalbytes S"

Thread Previous | Thread Next
September 5, 2016 15:18
Re: [perl #129196] Segmentation fault: "evalbytes S"
Message ID:
Dave Mitchell <> writes:

> On Mon, Sep 05, 2016 at 02:55:25PM +0100, Zefram wrote:
>> Dave Mitchell wrote:
>> >..\toke.c(7586) : error C2105: '--' needs l-value
>> ...
>> >7586: 	    UNIBRACK(-OP_ENTEREVAL);
>> >
>> >The error would seem to imply that OP_ENTEREVAL has been defined to a
>> >negative value,
>> That's not how the C preprocessor works.  Macro expansion can't paste
>> two adjacent "-" tokens into a "--".  In any case, the OP_ values have
>> never been negative.
> I guess that's a bug in the win C compiler? Which would explain why the
> problem hasn't surfaced on other platforms.

Looking at the preprocessor output (via 'make toke.i') from gcc, it
actually expands to:

  (PL_parser->last_lop_op) = -OP_ENTEREVAL < 0 ? - -OP_ENTEREVAL : -OP_ENTEREVAL

Note the space between the two minuses, despite there being no space in
the macro definition.  Presumably the MSVC preprocessor fails to insert
it.  The parentheses should still be there for other compilers, in case
someone uses a more complex expression in future.

"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About