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

NV_PAYLOAD_SIZEOF_ASSERT fails on PPC darwin #15481

Closed
p5pRT opened this issue Jul 28, 2016 · 5 comments
Closed

NV_PAYLOAD_SIZEOF_ASSERT fails on PPC darwin #15481

p5pRT opened this issue Jul 28, 2016 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 28, 2016

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

Searchable as RT128763$

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @cpansprout

make test output includes​:

ext/POSIX/t/math ............................................... Assertion failed​: (sizeof(m) == NVSIZE / 2), function S_setpayload, file POSIX.xs, line 1169.
FAILED--no leader found

Line 1169 of ext/POSIX/POSIX.xs is​:

  NV_PAYLOAD_SIZEOF_ASSERT(m);

That macro is defined as​:

#ifdef LONGDOUBLE_DOUBLEDOUBLE
# define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE / 2)
#else
# define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE)
#endif

so apparently LONGDOUBLE_DOUBLEDOUBLE must be defined.

m is declared as​:

  static const U8 m[] = { NV_NAN_PAYLOAD_MASK };

$ ./perl -Ilib Porting/expand-macro.pl NV_NAN_PAYLOAD_MASK
cc -c -DPERL_CORE -fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_FORTIFY_SOURCE=2 -DPERL_USE_SAFE_PUTENV -O3 -O0 -g -Wall -Wextra -Wwrite-strings -E try.c > try.i
# 4 "NV_NAN_PAYLOAD_MASK expands to"
0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff

$ ./perl -Ilib -V

Summary of my perl5 (revision 5 version 25 subversion 4) configuration​:
  Snapshot of​: a316481
  Platform​:
  osname=darwin
  osvers=9.7.0
  archname=darwin-2level
  uname='darwin treebeard.local 9.7.0 darwin kernel version 9.7.0​: tue mar 31 22​:54​:29 pdt 2009; root​:xnu-1228.12.14~1release_ppc power macintosh '
  config_args='-de -Dusedevel -DDEBUGGING -Aoptimize=-O0'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=undef
  use64bitall=undef
  uselongdouble=undef
  usemymalloc=n
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_FORTIFY_SOURCE=2 -DPERL_USE_SAFE_PUTENV'
  optimize='-O3 -O0 -g'
  cppflags='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion=''
  gccversion='4.0.1 (Apple Inc. build 5465)'
  gccosandvers=''
  intsize=4
  longsize=4
  ptrsize=4
  doublesize=8
  byteorder=4321
  doublekind=4
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=6
  ivtype='long'
  ivsize=4
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'
  ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-lpthread -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/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  DEBUGGING
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  PERL_USE_SAFE_PUTENV
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  Built under darwin
  Compiled at Jul 27 2016 18​:45​:08
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.25.4/darwin-2level
  /usr/local/lib/perl5/site_perl/5.25.4
  /usr/local/lib/perl5/5.25.4/darwin-2level
  /usr/local/lib/perl5/5.25.4
  .

Is that enough information?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @jhi

Try this​:

Inline Patch
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 3820026..a950af3 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -1153,7 +1153,7 @@ static NV my_trunc(NV x)
 #  define NV_PAYLOAD_TYPE NV
 #endif
 
-#ifdef LONGDOUBLE_DOUBLEDOUBLE
+#if defined(USE_LONG_DOUBLE) && defined(LONGDOUBLE_DOUBLEDOUBLE)
 #  define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE / 2)
 #else
 #  define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE)

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @cpansprout

On Thu Jul 28 05​:23​:59 2016, jhi wrote​:

Try this​:

diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 3820026..a950af3 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@​@​ -1153,7 +1153,7 @​@​ static NV my_trunc(NV x)
# define NV_PAYLOAD_TYPE NV
#endif

-#ifdef LONGDOUBLE_DOUBLEDOUBLE
+#if defined(USE_LONG_DOUBLE) && defined(LONGDOUBLE_DOUBLEDOUBLE)
# define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE / 2)
#else
# define NV_PAYLOAD_SIZEOF_ASSERT(a) assert(sizeof(a) == NVSIZE)

Worms like a shark! Erm, works like a charm, or whatever.

Thank you. I have applied it as d80a605.

I get the same failure with a debugging 5.24.0 on that machine. I think the patch should be backported to maint.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant