Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pack doesn't work in new gcc 4.9.1 compiler #14554

Closed
p5pRT opened this issue Mar 3, 2015 · 16 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Mar 3, 2015

Migrated from rt.perl.org#123971 (status was 'resolved')

Searchable as RT123971$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 3, 2015

From @khwilliamson

This is a bug report for perl from khw@​khw.(none),
generated with the help of perlbug 1.40 running under perl 5.21.10.


See http​://nntp.perl.org/group/perl.perl5.porters/225619
and following.

Tony Cook says "This looks like another "rubbish in the packing" issue."

# Failed test 4311 - at op/pack.t line 1127
# got
"\000\000\000\000\000V@​\x{8a}\x{b7}\x{ab}\x{c6}\'\005\003\005\x{ae}\x{80}\x{ff}\000\000\000\000\000V?s\x{b2}g\x{ed}\031@​\x{f1}\x{c6}\034"
# expected
"\000\000\000\000\002\x{f7}@​\x{8a}\x{b7}\x{ab}\x{c6}\'\005\003\005\x{ae}\x{80}\x{ff}\000\000\000\000\002\x{f7}?s\x{b2}g\x{ed}\031@​\x{f1}\x{c6}\034"
# Failed test 4316 - at op/pack.t line 1127
# got
"\x{ae}\005\003\005\'\x{c6}\x{ab}\x{b7}\x{8a}@​V\000\000\000\000\000\x{80}\x{ff}\034\x{c6}\x{f1}@​\031\x{ed}g\x{b2}s?V\000\000\000\000\000"
# expected
"\x{ae}\005\003\005\'\x{c6}\x{ab}\x{b7}\x{8a}@​\x{f7}\002\000\000\000\000\x{80}\x{ff}\034\x{c6}\x{f1}@​\031\x{ed}g\x{b2}s?\x{f7}\002\000\000\000\000"
# Failed test 4321 - at op/pack.t line 1127
# got
"@​I\017\x{d0}\000\000\000\000\000V@​\005\x{de}8Q\x{eb}\x{85}\036\x{b8}R@​\x{a1}\\p\x{a3}\x{d7}\n="
# expected
"@​I\017\x{d0}\000\000\000\000\002\x{f7}@​\005\x{de}8Q\x{eb}\x{85}\036\x{b8}R@​\x{a1}\\p\x{a3}\x{d7}\n="
# Failed test 4326 - at op/pack.t line 1127
# got
"\x{d0}\017I@​R\x{b8}\036\x{85}\x{eb}Q8\x{de}\005@​V\000\000\000\000\000=\n\x{d7}\x{a3}p\\\x{a1}@​"
# expected
"\x{d0}\017I@​R\x{b8}\036\x{85}\x{eb}Q8\x{de}\005@​\x{f7}\002\000\000\000\000=\n\x{d7}\x{a3}p\\\x{a1}@​"
op/pack.t ..........................................................
Failed 4/14708 subtests



Flags​:
  category=core
  severity=medium


Site configuration information for perl 5.21.10​:

Configured by khw at Mon Mar 2 08​:04​:33 MST 2015.

Summary of my perl5 (revision 5 version 21 subversion 10) configuration​:
  Derived from​: 0cd93ac
  Platform​:
  osname=linux, osvers=3.16.0-31-generic,
archname=x86_64-linux-thread-multi-ld
  uname='linux khw 3.16.0-31-generic #41-ubuntu smp tue feb 10
15​:24​:04 utc 2015 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Uversiononly -Dprefix=/home/khw/blead -Dusedevel
-D'optimize=-ggdb3' -A'optimize=-ggdb3' -A'optimize=-O0'
-Accflags='-DPERL_BOOL_AS_CHAR' -Dman1dir=none -Dman3dir=none
-DDEBUGGING -Dcc=g++ -Dusemorebits -Dusethreads'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  use64bitint=define, use64bitall=define, uselongdouble=define
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='g++', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_BOOL_AS_CHAR
-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-D_FORTIFY_SOURCE=2',
  optimize=' -ggdb3 -O0',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_BOOL_AS_CHAR -fwrapv
-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include'
  ccversion='', gccversion='4.9.1', 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='long double', nvsize=16,
Off_t='off_t', lseeksize=8
  alignbytes=16, prototype=define
  Linker and Libraries​:
  ld='g++', ldflags =' -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/include/c++/4.9 /usr/include/x86_64-linux-gnu/c++/4.9
/usr/include/c++/4.9/backward /usr/local/lib
/usr/lib/gcc/x86_64-linux-gnu/4.9/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 -ldl -lm -lcrypt -lutil -lc
  perllibs=-lpthread -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 -ggdb3 -ggdb3 -O0
-L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
  uncommitted-changes


@​INC for perl 5.21.10​:
  /home/khw/perl/blead/lib

/home/khw/blead/lib/perl5/site_perl/5.21.10/x86_64-linux-thread-multi-ld
  /home/khw/blead/lib/perl5/site_perl/5.21.10
  /home/khw/blead/lib/perl5/5.21.10/x86_64-linux-thread-multi-ld
  /home/khw/blead/lib/perl5/5.21.10
  /home/khw/blead/lib/perl5/site_perl/5.21.9
  /home/khw/blead/lib/perl5/site_perl/5.21.8
  /home/khw/blead/lib/perl5/site_perl/5.21.7
  /home/khw/blead/lib/perl5/site_perl/5.21.6
  /home/khw/blead/lib/perl5/site_perl/5.21.5
  /home/khw/blead/lib/perl5/site_perl/5.21.4
  /home/khw/blead/lib/perl5/site_perl/5.21.3
  /home/khw/blead/lib/perl5/site_perl/5.21.2
  /home/khw/blead/lib/perl5/site_perl/5.21.1
  /home/khw/blead/lib/perl5/site_perl/5.20.0
  /home/khw/blead/lib/perl5/site_perl/5.19.12
  /home/khw/blead/lib/perl5/site_perl/5.19.11
  /home/khw/blead/lib/perl5/site_perl/5.19.10
  /home/khw/blead/lib/perl5/site_perl
  .


Environment for perl 5.21.10​:
  HOME=/home/khw
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)

PATH=/home/khw/bin​:/home/khw/perl5/perlbrew/bin​:/home/khw/print/bin​:/bin​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/usr/games​:/usr/local/games​:/home/khw/cxoffice/bin
  PERL5OPT=-w
  PERL_BADLANG (unset)
  PERL_POD_PEDANTIC=1
  SHELL=/bin/ksh

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 3, 2015

From @jhi

Strangely, cannot repro in OS X with g++ 4.9.2 (*), with x86_64 and "Configure -des -Dusedevel".

Something about Ubuntu in particular?

It would be good to change t/op/pack.t​:1127 to be

  is($p1, $p2, "t=$t, c=$t");

There are a few spots in pp_pack.c where the pack() code intentionally calls Zero() for
this exact reason, maybe we are just missing some.

(*) g++-mp-4.9 (mp = MacPorts), -v saying "gcc version 4.9.2 (MacPorts gcc49 4.9.2_1)"

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 3, 2015

From [Unknown Contact. See original ticket]

Strangely, cannot repro in OS X with g++ 4.9.2 (*), with x86_64 and "Configure -des -Dusedevel".

Something about Ubuntu in particular?

It would be good to change t/op/pack.t​:1127 to be

  is($p1, $p2, "t=$t, c=$t");

There are a few spots in pp_pack.c where the pack() code intentionally calls Zero() for
this exact reason, maybe we are just missing some.

(*) g++-mp-4.9 (mp = MacPorts), -v saying "gcc version 4.9.2 (MacPorts gcc49 4.9.2_1)"

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 4, 2015

From @tonycoz

On Tue Mar 03 04​:04​:28 2015, jhi wrote​:

Strangely, cannot repro in OS X with g++ 4.9.2 (*), with x86_64 and
"Configure -des -Dusedevel".

Something about Ubuntu in particular?

It would be good to change t/op/pack.t​:1127 to be

is($p1, $p2, "t=$t, c=$t");

There are a few spots in pp_pack.c where the pack() code intentionally
calls Zero() for
this exact reason, maybe we are just missing some.

(*) g++-mp-4.9 (mp = MacPorts), -v saying "gcc version 4.9.2 (MacPorts
gcc49 4.9.2_1)"

You need at least -Dcc=g++ (it doesn't happen with gcc) and -Duselongdouble (the only floating point type with packing filler).

I tested that with gcc 5.0 today, but I reproduced it with 4.9.1 a few weeks ago.

Here's the relevant generated codecode​:

/home/tony/dev/perl/git/perl/pp_pack.c​:2732
  2d0c​: 41 0f b6 c0 movzbl %r8b,%eax
  2d10​: 4c 89 64 24 50 mov %r12,0x50(%rsp)
/home/tony/dev/perl/git/perl/pp_pack.c​:2723

; Zero()
  2d15​: 4c 8d b4 24 10 01 00 lea 0x110(%rsp),%r14
  2d1c​: 00
  2d1d​: 44 8b 64 24 40 mov 0x40(%rsp),%r12d
  2d22​: 48 c7 84 24 10 01 00 movq $0x0,0x110(%rsp)
  2d29​: 00 00 00 00 00
  2d2e​: 4c 89 6c 24 40 mov %r13,0x40(%rsp)
  2d33​: 48 c7 84 24 18 01 00 movq $0x0,0x118(%rsp)
  2d3a​: 00 00 00 00 00
  2d3f​: 4d 89 fd mov %r15,%r13
/home/tony/dev/perl/git/perl/pp_pack.c​:2732
  2d42​: 89 04 24 mov %eax,(%rsp)
  2d45​: 41 89 df mov %ebx,%r15d
  2d48​: 0f b6 5c 24 10 movzbl 0x10(%rsp),%ebx
  2d4d​: eb 50 jmp 2d9f <S_pack_rec+0x1b4f>
  2d4f​: 90 nop
/home/tony/dev/perl/git/perl/pp_pack.c​:2728
; call sv_2nv(), leaves result in %st(0)
  2d50​: be 02 00 00 00 mov $0x2,%esi
  2d55​: e8 00 00 00 00 callq 2d5a <S_pack_rec+0x1b0a>
  2d56​: R_X86_64_PC32 Perl_sv_2nv_flags+0xfffffffffffffffc
/home/tony/dev/perl/git/perl/pp_pack.c​:2732
; if (utf8)
  2d5a​: 84 db test %bl,%bl
/home/tony/dev/perl/git/perl/pp_pack.c​:2728
; store result of sv_2nv() in aldouble.ld
  2d5c​: d9 c0 fld %st(0)
  2d5e​: db bc 24 10 01 00 00 fstpt 0x110(%rsp)
/home/tony/dev/perl/git/perl/pp_pack.c​:2732
  2d65​: 0f 85 1d 10 00 00 jne 3d88 <S_pack_rec+0x2b38>
  2d6b​: 41 81 fc 00 02 00 00 cmp $0x200,%r12d
  2d72​: 0f 84 73 12 00 00 je 3feb <S_pack_rec+0x2d9b>
  2d78​: 49 83 c5 10 add $0x10,%r13

; the strange part, we already stored the result above, here we store it again
; into a a buffer we haven't zeroed, load that into %rsi/%rdi and
; save that into our pack output buffer
  2d7c​: db bc 24 90 00 00 00 fstpt 0x90(%rsp)
  2d83​: 48 8b b4 24 90 00 00 mov 0x90(%rsp),%rsi
  2d8a​: 00
  2d8b​: 48 8b bc 24 98 00 00 mov 0x98(%rsp),%rdi
  2d92​: 00
  2d93​: 49 89 75 f0 mov %rsi,-0x10(%r13)
  2d97​: 49 89 7d f8 mov %rdi,-0x8(%r13)
  2d9b​: 41 83 ef 01 sub $0x1,%r15d
; while()
/home/tony/dev/perl/git/perl/pp_pack.c​:2724
  2d9f​: 45 85 ff test %r15d,%r15d
  2da2​: 0f 8e e3 0a 00 00 jle 388b <S_pack_rec+0x263b>
/home/tony/dev/perl/git/perl/pp_pack.c​:2725
  2da8​: 48 85 ed test %rbp,%rbp
  2dab​: 48 89 ef mov %rbp,%rdi
  2dae​: 75 a0 jne 2d50 <S_pack_rec+0x1b00>
  2db0​: 8b 44 24 20 mov 0x20(%rsp),%eax
  2db4​: bf 00 00 00 00 mov $0x0,%edi
  2db5​: R_X86_64_32 PL_sv_no
  2db9​: 85 c0 test %eax,%eax
  2dbb​: 7e 93 jle 2d50 <S_pack_rec+0x1b00>
  2dbd​: 83 e8 01 sub $0x1,%eax
  2dc0​: 89 44 24 20 mov %eax,0x20(%rsp)
  2dc4​: 48 8b 44 24 38 mov 0x38(%rsp),%rax
  2dc9​: 48 8b 38 mov (%rax),%rdi
  2dcc​: 48 83 c0 08 add $0x8,%rax
  2dd0​: 48 89 44 24 38 mov %rax,0x38(%rsp)
  2dd5​: e9 76 ff ff ff jmpq 2d50 <S_pack_rec+0x1b00>

Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 4, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 4, 2015

From @jhi

I did use -Dcc=g++-mp-4.9, but not -Duselongdouble. (I had this mental glitch of long double packing working with just HAS_LONG_DOUBLE, without USE_LONG_DOUBLE, caused by prolonged exposure to printf() code which does exactly that...)

But nope, still no fail from op/pack.t in OS X, with g++ 4.9.2 and -Duselongdouble.

./miniperl -Ilib -V
Summary of my perl5 (revision 5 version 21 subversion 10) configuration​:
 
  Platform​:
  osname=darwin, osvers=14.1.0, archname=darwin-ld-2level
  uname='darwin jarkko-hietaniemis-imac.local 14.1.0 darwin kernel version 14.1.0​: mon dec 22 23​:10​:38 pst 2014; root​:xnu-2782.10.72~2release_x86_64 x86_64 '
  config_args='-des -Dusedevel -Dcc=g++-mp-4.9 -Duselongdouble'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  use64bitint=define, use64bitall=define, uselongdouble=define
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='g++-mp-4.9', ccflags ='-fno-common -DPERL_DARWIN -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include',
  optimize='-O3',
  cppflags='-fno-common -DPERL_DARWIN -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include'
  ccversion='', gccversion='4.9.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='long double', nvsize=16, Off_t='off_t', lseeksize=8
  alignbytes=16, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 g++-mp-4.9', ldflags =' -fstack-protector-strong -L/opt/local/lib -L/opt/local/lib/libgcc'
  libpth=/opt/local/include/gcc49/c++/ /opt/local/include/gcc49/c++//x86_64-apple-darwin14 /opt/local/include/gcc49/c++//backward /opt/local/lib /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include-fixed /usr/lib /opt/local/lib/libgcc
  libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
  perllibs=-lpthread -ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -L/opt/local/lib/libgcc -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_EXTERNAL_GLOB PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
  PERL_IS_MINIPERL 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_LOCALE_TIME
  USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF
  USE_SITECUSTOMIZE
  Built under darwin
  Compiled at Mar 4 2015 15​:42​:24
  @​INC​:
  /Users/jhi/perl/cpan/AutoLoader/lib
  /Users/jhi/perl/dist/Carp/lib
  /Users/jhi/perl/dist/PathTools
  /Users/jhi/perl/dist/PathTools/lib
  /Users/jhi/perl/cpan/ExtUtils-Command/lib
  /Users/jhi/perl/cpan/ExtUtils-Install/lib
  /Users/jhi/perl/cpan/ExtUtils-MakeMaker/lib
  /Users/jhi/perl/cpan/ExtUtils-Manifest/lib
  /Users/jhi/perl/cpan/File-Path/lib
  /Users/jhi/perl/ext/re
  /Users/jhi/perl/dist/Term-ReadLine/lib
  /Users/jhi/perl/dist/Exporter/lib
  /Users/jhi/perl/ext/File-Find/lib
  /Users/jhi/perl/cpan/Text-Tabs/lib
  /Users/jhi/perl/dist/constant/lib
  /Users/jhi/perl/lib
  .

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 4, 2015

From [Unknown Contact. See original ticket]

I did use -Dcc=g++-mp-4.9, but not -Duselongdouble. (I had this mental glitch of long double packing working with just HAS_LONG_DOUBLE, without USE_LONG_DOUBLE, caused by prolonged exposure to printf() code which does exactly that...)

But nope, still no fail from op/pack.t in OS X, with g++ 4.9.2 and -Duselongdouble.

./miniperl -Ilib -V
Summary of my perl5 (revision 5 version 21 subversion 10) configuration​:
 
  Platform​:
  osname=darwin, osvers=14.1.0, archname=darwin-ld-2level
  uname='darwin jarkko-hietaniemis-imac.local 14.1.0 darwin kernel version 14.1.0​: mon dec 22 23​:10​:38 pst 2014; root​:xnu-2782.10.72~2release_x86_64 x86_64 '
  config_args='-des -Dusedevel -Dcc=g++-mp-4.9 -Duselongdouble'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  use64bitint=define, use64bitall=define, uselongdouble=define
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='g++-mp-4.9', ccflags ='-fno-common -DPERL_DARWIN -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include',
  optimize='-O3',
  cppflags='-fno-common -DPERL_DARWIN -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include'
  ccversion='', gccversion='4.9.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='long double', nvsize=16, Off_t='off_t', lseeksize=8
  alignbytes=16, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 g++-mp-4.9', ldflags =' -fstack-protector-strong -L/opt/local/lib -L/opt/local/lib/libgcc'
  libpth=/opt/local/include/gcc49/c++/ /opt/local/include/gcc49/c++//x86_64-apple-darwin14 /opt/local/include/gcc49/c++//backward /opt/local/lib /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include-fixed /usr/lib /opt/local/lib/libgcc
  libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
  perllibs=-lpthread -ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -L/opt/local/lib/libgcc -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_EXTERNAL_GLOB PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
  PERL_IS_MINIPERL 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_LOCALE_TIME
  USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF
  USE_SITECUSTOMIZE
  Built under darwin
  Compiled at Mar 4 2015 15​:42​:24
  @​INC​:
  /Users/jhi/perl/cpan/AutoLoader/lib
  /Users/jhi/perl/dist/Carp/lib
  /Users/jhi/perl/dist/PathTools
  /Users/jhi/perl/dist/PathTools/lib
  /Users/jhi/perl/cpan/ExtUtils-Command/lib
  /Users/jhi/perl/cpan/ExtUtils-Install/lib
  /Users/jhi/perl/cpan/ExtUtils-MakeMaker/lib
  /Users/jhi/perl/cpan/ExtUtils-Manifest/lib
  /Users/jhi/perl/cpan/File-Path/lib
  /Users/jhi/perl/ext/re
  /Users/jhi/perl/dist/Term-ReadLine/lib
  /Users/jhi/perl/dist/Exporter/lib
  /Users/jhi/perl/ext/File-Find/lib
  /Users/jhi/perl/cpan/Text-Tabs/lib
  /Users/jhi/perl/dist/constant/lib
  /Users/jhi/perl/lib
  .

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 5, 2015

From @jhi

I tried poking around to get to see the same disassembly but it seems that with OS X no can do. The g++ -S does some, there's otool(1) which is kind of objdump, but it's not the same. But I *think* by visual fuzzy grep this is the same spot as seen by (a) g++ -S -fverbose-asm (b) otool -tvVj​:

(a)

L2017​:
  movq 152(%rsp), %rax # %sfp, tmp5913
  leaq 207(%rsp), %r15 #, tmp5885
  movq %r14, 16(%rsp) # symptr, %sfp
  movq %rbx, %r14 # cur, cur
  movq %r15, 32(%rsp) # tmp5885, %sfp
  movzbl 70(%rsp), %ebx # %sfp, utf8
  movl %r12d, %r15d # ivtmp.2318, ivtmp.2318
  movq 160(%rsp), %r12 # %sfp, tmp5914
  movq $0, (%rax) #, MEM[(void *)&aldouble]
  movq $0, 8(%rax) #, MEM[(void *)&aldouble]
  jmp L2501 #
  .align 4,0x90
L2502​:
  movl $2, %esi #,
  call _Perl_sv_2nv_flags #
  testb %bl, %bl # utf8
  fstpt 208(%rsp) # aldouble.ld
  jne L3690 #,
  testb %r13b, %r13b # needs_swap
  jne L3691 #,
  movq 208(%rsp), %rsi # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})&aldouble]
  movq 216(%rsp), %rdi # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})&aldouble]
  movq %rsi, (%r14) # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})cur_335]
  movq %rdi, 8(%r14) # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})cur_335]
L2513​:
  addq $16, %r14 #, cur
L2508​:
  subl $1, %r15d #, ivtmp.2318
L2501​:
  testl %r15d, %r15d # ivtmp.2318
  jle L3692 #,

(b)

000000000000b5c8 488b842498000000 movq 0x98(%rsp), %rax
000000000000b5d0 4c8dbc24cf000000 leaq 0xcf(%rsp), %r15
000000000000b5d8 4c89742410 movq %r14, 0x10(%rsp)
000000000000b5dd 4989de movq %rbx, %r14
000000000000b5e0 4c897c2420 movq %r15, 0x20(%rsp)
000000000000b5e5 0fb65c2446 movzbl 0x46(%rsp), %ebx
000000000000b5ea 4589e7 movl %r12d, %r15d
000000000000b5ed 4c8ba424a0000000 movq 0xa0(%rsp), %r12
000000000000b5f5 48c70000000000 movq $__ZL9doencodesPhPKhi, __ZL9doencodesPhPKhi(%rax) ## doencodes(unsigned char*, unsigned char const*, int)doencodes(unsigned char*, unsigned char const*, int)
000000000000b5fc 48c7400800000000 movq $__ZL9doencodesPhPKhi, 0x8(%rax) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b604 eb4b jmp 0xb651
000000000000b606 662e0f1f840000000000 nopw %cs​:__ZL9doencodesPhPKhi(%rax,%rax) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b610 be02000000 movl $0x2, %esi
000000000000b615 e800000000 callq _Perl_sv_2nv_flags
000000000000b61a 84db testb %bl, %bl
000000000000b61c dbbc24d0000000 fstpt 0xd0(%rsp)
000000000000b623 0f850a1c0000 jne 0xd233
000000000000b629 4584ed testb %r13b, %r13b
000000000000b62c 0f856d230000 jne 0xd99f
000000000000b632 488bb424d0000000 movq 0xd0(%rsp), %rsi
000000000000b63a 488bbc24d8000000 movq 0xd8(%rsp), %rdi
000000000000b642 498936 movq %rsi, __ZL9doencodesPhPKhi(%r14) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b645 49897e08 movq %rdi, 0x8(%r14)
000000000000b649 4983c610 addq $0x10, %r14
000000000000b64d 4183ef01 subl $0x1, %r15d
000000000000b651 4585ff testl %r15d, %r15d
000000000000b654 0f8ec11b0000 jle 0xd21b

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 5, 2015

From [Unknown Contact. See original ticket]

I tried poking around to get to see the same disassembly but it seems that with OS X no can do. The g++ -S does some, there's otool(1) which is kind of objdump, but it's not the same. But I *think* by visual fuzzy grep this is the same spot as seen by (a) g++ -S -fverbose-asm (b) otool -tvVj​:

(a)

L2017​:
  movq 152(%rsp), %rax # %sfp, tmp5913
  leaq 207(%rsp), %r15 #, tmp5885
  movq %r14, 16(%rsp) # symptr, %sfp
  movq %rbx, %r14 # cur, cur
  movq %r15, 32(%rsp) # tmp5885, %sfp
  movzbl 70(%rsp), %ebx # %sfp, utf8
  movl %r12d, %r15d # ivtmp.2318, ivtmp.2318
  movq 160(%rsp), %r12 # %sfp, tmp5914
  movq $0, (%rax) #, MEM[(void *)&aldouble]
  movq $0, 8(%rax) #, MEM[(void *)&aldouble]
  jmp L2501 #
  .align 4,0x90
L2502​:
  movl $2, %esi #,
  call _Perl_sv_2nv_flags #
  testb %bl, %bl # utf8
  fstpt 208(%rsp) # aldouble.ld
  jne L3690 #,
  testb %r13b, %r13b # needs_swap
  jne L3691 #,
  movq 208(%rsp), %rsi # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})&aldouble]
  movq 216(%rsp), %rdi # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})&aldouble]
  movq %rsi, (%r14) # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})cur_335]
  movq %rdi, 8(%r14) # MEM[(char * {ref-all})&aldouble], MEM[(char * {ref-all})cur_335]
L2513​:
  addq $16, %r14 #, cur
L2508​:
  subl $1, %r15d #, ivtmp.2318
L2501​:
  testl %r15d, %r15d # ivtmp.2318
  jle L3692 #,

(b)

000000000000b5c8 488b842498000000 movq 0x98(%rsp), %rax
000000000000b5d0 4c8dbc24cf000000 leaq 0xcf(%rsp), %r15
000000000000b5d8 4c89742410 movq %r14, 0x10(%rsp)
000000000000b5dd 4989de movq %rbx, %r14
000000000000b5e0 4c897c2420 movq %r15, 0x20(%rsp)
000000000000b5e5 0fb65c2446 movzbl 0x46(%rsp), %ebx
000000000000b5ea 4589e7 movl %r12d, %r15d
000000000000b5ed 4c8ba424a0000000 movq 0xa0(%rsp), %r12
000000000000b5f5 48c70000000000 movq $__ZL9doencodesPhPKhi, __ZL9doencodesPhPKhi(%rax) ## doencodes(unsigned char*, unsigned char const*, int)doencodes(unsigned char*, unsigned char const*, int)
000000000000b5fc 48c7400800000000 movq $__ZL9doencodesPhPKhi, 0x8(%rax) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b604 eb4b jmp 0xb651
000000000000b606 662e0f1f840000000000 nopw %cs​:__ZL9doencodesPhPKhi(%rax,%rax) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b610 be02000000 movl $0x2, %esi
000000000000b615 e800000000 callq _Perl_sv_2nv_flags
000000000000b61a 84db testb %bl, %bl
000000000000b61c dbbc24d0000000 fstpt 0xd0(%rsp)
000000000000b623 0f850a1c0000 jne 0xd233
000000000000b629 4584ed testb %r13b, %r13b
000000000000b62c 0f856d230000 jne 0xd99f
000000000000b632 488bb424d0000000 movq 0xd0(%rsp), %rsi
000000000000b63a 488bbc24d8000000 movq 0xd8(%rsp), %rdi
000000000000b642 498936 movq %rsi, __ZL9doencodesPhPKhi(%r14) ## doencodes(unsigned char*, unsigned char const*, int)
000000000000b645 49897e08 movq %rdi, 0x8(%r14)
000000000000b649 4983c610 addq $0x10, %r14
000000000000b64d 4183ef01 subl $0x1, %r15d
000000000000b651 4585ff testl %r15d, %r15d
000000000000b654 0f8ec11b0000 jle 0xd21b

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 27, 2015

From @khwilliamson

If this doesn't get fixed for v5.22, the branch at
http​://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-pack
turns the failing tests into TODOs.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 27, 2015

From [Unknown Contact. See original ticket]

If this doesn't get fixed for v5.22, the branch at
http​://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-pack
turns the failing tests into TODOs.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 9, 2015

From @tonycoz

On Thu Mar 26 20​:59​:53 2015, khw wrote​:

If this doesn't get fixed for v5.22, the branch at
http​://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-pack
turns the failing tests into TODOs.

Please try the attached patch.

Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 9, 2015

From @tonycoz

0001-perl-123971-fix-long-double-pack-padding-on-newer-GC.patch
From a2db6c92fc2880ba1f288b6c4599a779997dd4e7 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 9 Apr 2015 15:45:16 +1000
Subject: [PATCH] [perl #123971] fix long double pack padding on newer GCC

---
 pp_pack.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pp_pack.c b/pp_pack.c
index 06adade..1d732a8 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -2709,6 +2709,12 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
 #ifdef __GNUC__
 		/* to work round a gcc/x86 bug; don't use SvNV */
 		anv.nv = sv_2nv(fromstr);
+#    if defined(LONGDOUBLE_X86_80_BIT) && defined(USE_LONG_DOUBLE) \
+         && LONG_DOUBLESIZE > 10
+                /* GCC sometimes overwrites the padding in the
+                   assignment above */
+                Zero(anv.bytes+10, sizeof(anv.bytes) - 10, U8);
+#    endif
 #else
 		anv.nv = SvNV(fromstr);
 #endif
@@ -2726,6 +2732,11 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
 #  ifdef __GNUC__
 		/* to work round a gcc/x86 bug; don't use SvNV */
 		aldouble.ld = (long double)sv_2nv(fromstr);
+#    if defined(LONGDOUBLE_X86_80_BIT) && LONG_DOUBLESIZE > 10
+                /* GCC sometimes overwrites the padding in the
+                   assignment above */
+                Zero(aldouble.bytes+10, sizeof(aldouble.bytes) - 10, U8);
+#    endif
 #  else
 		aldouble.ld = (long double)SvNV(fromstr);
 #  endif
-- 
1.7.10.4

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 9, 2015

From @khwilliamson

On 04/08/2015 11​:46 PM, Tony Cook via RT wrote​:

On Thu Mar 26 20​:59​:53 2015, khw wrote​:

If this doesn't get fixed for v5.22, the branch at
http​://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-pack
turns the failing tests into TODOs.

Please try the attached patch.

Tony

This patch causes the previously failing tests to now pass.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 10, 2015

From @tonycoz

On Thu Apr 09 11​:49​:15 2015, public@​khwilliamson.com wrote​:

Please try the attached patch.

This patch causes the previously failing tests to now pass.

Applied as 070e267.

Tony

@p5pRT p5pRT closed this Apr 10, 2015
@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 10, 2015

@tonycoz - Status changed from 'open' to 'resolved'

@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.