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

5.20.1 / state bug

Thread Previous | Thread Next
From:
Niels Larsen
Date:
October 21, 2014 15:04
Subject:
5.20.1 / state bug
Message ID:
1413903749.4559.3.camel@think2
Perl developers,

The script below shows what I believe is an error in 5.20.1 and 
possibly other version, haven't tried - a state scalar becomes 
undefined when copied from. Output from perl -V is also below. 
Note copy-on-write is off, when on the state value keeps its 
value. 

My code base depends on being able to turn cow off and will 
stay with the latest perl that allows that (please .. don't 
remove that option; I can explain why, but it has to do with 
C-routines etc). I am not constrained by perl generally, just 
a few annoyances (inability to reclaim memory, to uninstall a 
module, to get warnings for unused variables). 

Niels L

----------------------------------------------------------------

#!/usr/bin/env perl

use strict;
use warnings FATAL => qw ( all );

use feature "state";

&state_test();
&state_test();

sub state_test
{
    state $str;
    my ( $str_c );

    $str = "string value";

    print "before: ". $str ."\n";
    $str_c = $str;
    print "      after: ". ( $str // "undef" ) ."\n";
    
    return;
}

-----------------------------------------------------------------

Summary of my perl5 (revision 5 version 20 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=3.13.0-24-generic, archname=i686-linux-64int
    uname='linux think2 3.13.0-24-generic #47-ubuntu smp fri may 2
23:31:42 utc 2014 i686 gnulinux '
    config_args='-de -Accflags=-fPIC -Accflags=-DPERL_NO_COW
-Dprefix=/home/niels/BION/Software/Package_installs/Perl -Duse64bitint'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fPIC -DPERL_NO_COW -fwrapv -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fPIC -DPERL_NO_COW -fwrapv -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'

libpth=/home/niels/BION/Software/lib /usr/local/lib /usr/lib/gcc/i686-linux-gnu/4.8/include-fixed /usr/include/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  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_PRESERVE_IVUV PERL_SAWAMPERSAND
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 14 2014 20:40:59
  @INC:
    /home/niels/BION/Software/Package_installs/Perl/lib/perl5/site_perl/5.20.1/i686-linux-64int
    /home/niels/BION/Software/Package_installs/Perl/lib/perl5/site_perl/5.20.1
    /home/niels/BION/Software/Package_installs/Perl/lib/perl5/5.20.1/i686-linux-64int
    /home/niels/BION/Software/Package_installs/Perl/lib/perl5/5.20.1
    .

--------------------------------------------------------------------------



Thread Previous | Thread Next


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