This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix 'for reverse @array' bug on AIX
authorDavid Mitchell <davem@iabyn.com>
Wed, 17 Oct 2018 14:10:10 +0000 (15:10 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 17 Oct 2018 14:10:10 +0000 (15:10 +0100)
commitd6139ec4a9065ae249ab512398326a70dfb2fea2
tree308cc34430ba8c3c7e5cd9bd959e8ae7e188957d
parent747c94edea492266c6c728a9dfe08ab31180e02f
fix 'for reverse @array' bug on AIX

RT #133558

Due to what appears to be a compiler bug on AIX (or perhaps it's
undefined behaviour which happens to work on other platforms), this line
of code in pp_iter():

    inc = 1 - (PL_op->op_private & OPpITER_REVERSED);

was setting inc to 4294967295 rather than to the expected -1 (inc was a
64-bit signed long).

Fix it with a couple of judicious (IV) casts (which ought to be a NOOP).
pp_hot.c
t/op/for.t