develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #120075] repeation operator does not throw error when right operand is too large

From:
Victor Efimov
Date:
October 2, 2013 12:41
Subject:
[perl #120075] repeation operator does not throw error when right operand is too large
Message ID:
rt-3.6.HEAD-31239-1380717638-1138.120075-75-0@perl.org
# New Ticket Created by  Victor Efimov 
# Please include the string:  [perl #120075]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=120075 >


$perl -e 'print length("x" x (2**30)), "\n"'
1073741824

$perl -e 'print length("x" x (2**60)), "\n"'
Out of memory!
panic: fold_constants JMPENV_PUSH returned 2 at -e line 1.

$perl -e 'print length("x" x (2**99)), "\n"'
0

$ perl -V
Summary of my perl5 (revision 5 version 19 subversion 4) configuration:

  Platform:
    osname=linux, osvers=2.6.38-16-generic, archname=x86_64-linux
    uname='linux green-u 2.6.38-16-generic #67~lucid1-ubuntu smp fri sep 7
18:18:45 utc 2012 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/vse/perl5/perlbrew/perls/perl-5.19.4
-Dusedevel -Aeval:scriptdir=/home/vse/perl5/perlbrew/perls/perl-5.19.4/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include'
    ccversion='', gccversion='4.4.3', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib
/usr/lib/x86_64-linux-gnu /lib64 /usr/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.1.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.1'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF
  Built under linux
  Compiled at Sep 21 2013 20:11:23
  %ENV:
    PERLBREW_MANPATH="/home/vse/perl5/perlbrew/perls/perl-5.19.4/man"

PERLBREW_PATH="/home/vse/perl5/perlbrew/bin:/home/vse/perl5/perlbrew/perls/perl-5.19.4/bin"
    PERLBREW_PERL="perl-5.19.4"
    PERLBREW_ROOT="/home/vse/perl5/perlbrew"
    PERLBREW_SKIP_INIT="1"
    PERLBREW_VERSION="0.65"
  @INC:

/home/vse/perl5/perlbrew/perls/perl-5.19.4/lib/site_perl/5.19.4/x86_64-linux
    /home/vse/perl5/perlbrew/perls/perl-5.19.4/lib/site_perl/5.19.4
    /home/vse/perl5/perlbrew/perls/perl-5.19.4/lib/5.19.4/x86_64-linux
    /home/vse/perl5/perlbrew/perls/perl-5.19.4/lib/5.19.4
    .



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About