develooper Front page | perl.perl5.porters | Postings from March 2003

[perl #21542] local $_ [0] = $_ [0] fails.

Thread Next
March 11, 2003 12:41
[perl #21542] local $_ [0] = $_ [0] fails.
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #21542]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.34 running under perl v5.8.0.

[Please enter your report here]


    sub bar {local $_ [0] = $_ [0];}

    my  $str = 'foo';

    bar $str;
    bar $str;

    print $str, "\n";


This program just prints a newline. Making small changes to the
program can cause segmentation violations. Running this through
valgrind gives a segmentation fault:

    $ /opt/valgrind/bin/valgrind perl
    ==272== valgrind-20020426, a memory error detector for x86 GNU/Linux.
    ==272== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
    ==272== Estimated CPU clock rate is 801 MHz
    ==272== For more details, rerun with: -v
    ==272== Invalid read of size 4
    ==272==    at 0x80FAB0B: Perl_leave_scope (scope.c:719)
    ==272==    by 0x80F8C9D: Perl_pop_scope (scope.c:136)
    ==272==    by 0x80D0731: Perl_pp_leavesub (pp_hot.c:2286)
    ==272==    by 0x80B3583: Perl_runops_debug (dump.c:1398)
    ==272==    Address 0x42114B94 is 0 bytes inside a block of size 16 free'd
    ==272==    at 0x400400A2: free (vg_clientfuncs.c:171)
    ==272==    by 0x80B3E40: Perl_safesysfree (util.c:151)
    ==272==    by 0x80C6421: Perl_av_undef (av.c:457)
    ==272==    by 0x80DD281: Perl_sv_clear (sv.c:5020)
    ==272== Invalid write of size 4
    ==272==    at 0x80FAB8A: Perl_leave_scope (scope.c:727)
    ==272==    by 0x80F8C9D: Perl_pop_scope (scope.c:136)
    ==272==    by 0x80D0731: Perl_pp_leavesub (pp_hot.c:2286)
    ==272==    by 0x80B3583: Perl_runops_debug (dump.c:1398)
    ==272==    Address 0x20 is not stack'd, malloc'd or free'd
    Segmentation fault

This problems happens from 5.7.0 onwards, including in today's blead,
and also in 5.6.1. There is no problem in 5.6.0. 

[Please do not change anything below this line]
Site configuration information for perl v5.8.0:

Configured by camel at Mon Oct 28 01:28:45 CET 2002.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
    osname=linux, osvers=2.4.18-bf2.4, archname=i686-linux-64int-ld
    uname='linux alexandra 2.4.18-bf2.4 #1 son apr 14 09:53:28 cest 2002 i686 unknown '
    config_args='-des -Uversiononly -Doptimize=-g -Dusemorebits -Dusedevel -Dusenm=false -Dprefix=/opt/perl -Dcc=gcc'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=define
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-DDEBUGGING -fno-strict-aliasing'
    ccversion='', gccversion='3.0.4', 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='long double', nvsize=12, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl v5.8.0:

Environment for perl v5.8.0:
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About