in reply to Re^8: Perl 64-bit versions
in thread Perl 64-bit versions

I can confirm the problem for 4060380287, both with 5.14.2 and 5.15.8 (64-bit)

$ /usr/local/perl/5.14.2/bin/perl -we '$v=""; vec($v,4060380287,1)=1' Negative offset to vec in lvalue context at -e line 1. $ /usr/local/perl/5.15.8/bin/perl -we '$v=""; vec($v,4060380287,1)=1' Negative offset to vec in lvalue context at -e line 1.

but not for 2**32 (and above — in which case it wraps around1).  Actually, it seems 2**31 .. 2**32-1 is buggy, though I haven't tested each and every one individually.

For reference, my relevant config settings:

... Compiler: cc='gcc ', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasi +ng -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE - +D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='', gccversion='4.3.2 [gcc-4_3-branch revision 141291]', + gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define ... Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_D +EVEL USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API

___

1 as I can find no mention in vec that the offset is limited to 32-bit on 64-bit builds, this could be considered a bug, too, even though it doesn't croak in this case.

$ perl -wE '$v=""; vec($v,2**32+42,1)=1; say "wrapped" if vec($v,42,1) +' wrapped

Replies are listed 'Best First'.
Re^10: Perl 64-bit versions
by BrowserUk (Patriarch) on Mar 13, 2012 at 18:53 UTC
    I can confirm the problem for 4060380287, both with 5.14.2 and 5.15.8 (64-bit) ... Actually, it seems 2**31 .. 2**32-1 is buggy,

    Ah! Okay. Thank you very much. Have you reported it, or shall I?

    Now to try and think of a work around ...


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Have you reported it, or shall I?

      No, I haven't reported it (yet). So feel free to go ahead...

        Done: "Negative offset to vec in lvalue context". Your ticket has been assigned an ID of [perl #111730].


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?