New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subject: List::Util qw(min) bug #15007
Comments
From @lonerrCreated by @lonerrThis is a bug report for perl from oleg@mamontov.net, ----------------------------------------------------------------- use strict; use List::Util qw(min); my $x = [qw( 1 1 1 1 1 )]; for ( 1..10 ) { but simple adding zero to the first argument fixes 'min' behaviour: use strict; use List::Util qw(min); my $x = [qw( 1 1 1 1 1 )]; for ( 1..10 ) { It looks like the 'min' was broken between 5.16 and 5.18. Perl Info
|
From @shlomifOn Fri Oct 23 15:07:47 2015, oleg@mamontov.net wrote:
I can reproduce this problem on bleadperl on Mageia Linux x86-64 v6. Seems like it has to do with the handling of "magic" values. I should also note that assigning $#$x to a "my Regards, -- Shlomi Fish |
The RT System itself - Status changed from 'new' to 'open' |
From @shlomifOn Sun Oct 25 00:29:12 2015, shlomif wrote:
«git bisect start v5.18.0 v5.16.0» eventually gives me this: < QUOTE > shlomif@telaviv1:~/Download/unpack/perl/p5/git/perl$ git bisect good Magic flags harmonization. :100644 100644 05516688ceca341ac1f63a7f72f63f38c03c18c6 ce7af44486749f954ef01ca9947a30929cd521ea M av.c < / QUOTE > Regards, -- Shlomi
|
From @ikegamiWorkaround: splice(@$x, 4); # Warns in older versions (<5.12?) of Perl Should be faster too. (It avoids creating two magic variables.) |
From @tonycozOn Fri Oct 23 15:07:47 2015, oleg@mamontov.net wrote:
Scalar-List-Utils is maintained upstream, on CPAN. This is a bug in the slu_sv_value() macro in ListUtil.xs: # define slu_sv_value(sv) (SvIOK(sv)) ? (SvIOK_UV(sv)) ? (NV)(SvUVX(sv)) : (NV)(SvIVX(sv)) : (SvNV(sv)) This macro is called without checking for GMAGIC on the SV, so the flags are meaningless, changing the macro to: # define slu_sv_value(sv) (SvGETMAGIC(sv), SvIOK(sv)) ? (SvIOK_UV(sv)) ? (NV)(SvUVX(sv)) : (NV)(SvIVX(sv)) : (SvNV(sv)) fixes the reported case, but will result in duplicate magic calls. This can probably be fixed by replacing SvNV() with SvNV_nomg(), but I haven't done any extensive testing. The bisect to 4bac9ae is happening because prior to that commit, IOK would not be set on a magic SV, so SvNV() would always be called in the macro, properly calling get magic. I've opened a ticket upstream: https://rt.cpan.org/Ticket/Display.html?id=107970 Any further discussion belongs there. Rejecting this ticket. Tony |
@tonycoz - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#126440 (status was 'rejected')
Searchable as RT126440$
The text was updated successfully, but these errors were encountered: