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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |