develooper Front page | perl.perl5.porters | Postings from December 2017

[perl #132638] I've discovered a segfault

Thread Previous | Thread Next
From:
Danijel Tasov
Date:
December 22, 2017 19:11
Subject:
[perl #132638] I've discovered a segfault
Message ID:
rt-4.0.24-13880-1513849979-431.132638-75-0@perl.org
# New Ticket Created by  Danijel Tasov 
# Please include the string:  [perl #132638]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132638 >



This is a bug report for perl from data@cpan.org,
generated with the help of perlbug 1.40 running under perl 5.26.1.


-----------------------------------------------------------------
[Please describe your issue here]

Hi,

i've run accross a segmentation fault with the following script:

package Clock;
use 5.010;
use strict;

use overload
'+' => \&add_time,
'-' => \&sub_time,
'eq' => \&equals_to,
'""' => \&to_string;

sub equals_to{ $_[0] eq $_[1] }
sub to_string { sprintf '%02d:%02d', $_[0][0] // 0, $_[0][1] // 0; }
sub new { bless( $_[1], $_[0] ); }

package main;
Clock->new([8,0]) eq "08:00"
__END__

The SIGSEGV goes away when I change equals_to to:

    sub equals_to{ $_[0]->to_string eq $_[1] }

bye,

Danijel

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.26.1:

Configured by danielt at Thu Dec 21 07:13:42 CET 2017.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration:
   
  Platform:
    osname=linux
    osvers=4.9.57
    archname=x86_64-linux
    uname='linux banjo.rbfh.de 4.9.57 #1 smp sat oct 21 15:46:05 cest 2017 x86_64 gnulinux '
    config_args='-de -Dprefix=/opt/perl/perls/perl-5.26.1 -Aeval:scriptdir=/opt/perl/perls/perl-5.26.1/bin'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion=''
    gccversion='4.7.2'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    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 /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.13'
  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'


---
@INC for perl 5.26.1:
    /opt/perl/perls/perl-5.26.1/lib/site_perl/5.26.1/x86_64-linux
    /opt/perl/perls/perl-5.26.1/lib/site_perl/5.26.1
    /opt/perl/perls/perl-5.26.1/lib/5.26.1/x86_64-linux
    /opt/perl/perls/perl-5.26.1/lib/5.26.1

---
Environment for perl 5.26.1:
    HOME=/home/danielt
    LANG=C
    LANGUAGE=C
    LC_CTYPE=de_DE.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/perl/bin:/opt/perl/perls/perl-5.26.1/bin:/usr/local/go/bin:/home/danielt/.nvm/v8.1.4/bin:/opt/python/2_007_008/bin:/opt/aperl/bin:/home/danielt/bin:/home/danielt/unix/bin:/usr/opt/bin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin/xscreensaver-hacks/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/home/danielt/bin:/usr/pkg/bin:/usr/pkg/sbin:/home/danielt/.rvm/bin
    PERLBREW_BASHRC_VERSION=0.73
    PERLBREW_HOME=/home/danielt/.perlbrew
    PERLBREW_MANPATH=/opt/perl/perls/perl-5.26.1/man
    PERLBREW_PATH=/opt/perl/bin:/opt/perl/perls/perl-5.26.1/bin
    PERLBREW_PERL=perl-5.26.1
    PERLBREW_ROOT=/opt/perl
    PERLBREW_SHELLRC_VERSION=0.82
    PERLBREW_VERSION=0.82
    PERL_BADLANG (unset)
    PERL_CPANM_OPT=--skip-installed --prompt --mirror http://cpan.cpantesters.org
    SHELL=/bin/zsh


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