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

In reply to Re^9: Perl 64-bit versions by Eliya
in thread Perl 64-bit versions by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.