Odd output with 5.16.0, x86-64int architecture

2012-09-06 Thread Sisyphus

Hi,

Here's the demo (Inline::C) script:

###
use warnings;
use Config;
use Math::MPFR qw(:mpfr);

use Inline C = Config =
   CCFLAGS = -D__USE_MINGW_ANSI_STDIO=1  . $Config{ccflags},
   BUILD_NOISY = 1;

use Inline C = 'EOC';

#include stdio.h
#include stdlib.h
#include math.h

void check(char * in, SV * digits) {
dXSARGS;
long double ld;
char *ptr, *buffer;;

ld = strtold(in, ptr);

buffer = malloc(32 * sizeof(char));
sprintf(buffer, %.*Le, SvUV(digits) - 1, ld);
ST(0) = sv_2mortal(newSVpv(buffer, 0));
free(buffer);
XSRETURN(1);

}

EOC

print check('1e-37', 18), \n;
###

For both the x86 and x64 builds of Strawberry Perl-5.16.0 that script 
correctly outputs:

1.0e-037

But for the x86-64int build of Strawberry Perl-5.16.0 I'm getting:
-0.0e+000

Does anyone see a reason for this anomalous behaviour with the x86-64int 
build ?
I get precisely the same output with an x86-64int perl-5.16.0 that I built 
using mingw.org's gcc-4.5.2.


Here's the 'perl -V' of the problem Strawberry Perl:


Summary of my perl5 (revision 5 version 16 subversion 0) configuration:

 Platform:
   osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread-64int
   uname='Win32 spp-spec-64int 5.16.0.1 #1 Tue May 22 21:03:41 2012 i386'
   config_args='undef'
   hint=recommended, useposix=true, d_sigaction=undef
   useithreads=define, usemultiplicity=define
   useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
   use64bitint=define, use64bitall=undef, uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='gcc', ccflags 
=' -s -O2 -DWIN32  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT

_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
   optimize='-s -O2',
   cppflags='-DWIN32'
   ccversion='', gccversion='4.6.3', gccosandvers=''
   intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
   d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
   ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long 
long',

lseeksize=8
   alignbytes=8, prototype=define
 Linker and Libraries:
   ld='g++.exe', ldflags 
='-s -LC:\_32\strawberry516_64int\perl\lib\CORE -LC

:\_32\strawberry516_64int\c\lib'
   libpth=C:\_32\strawberry516_64int\c\lib 
C:\_32\strawberry516_64int\c\i686-w6

4-mingw32\lib
   libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
-lodbc32 -lodbccp32 -lcomctl32
   perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva
pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver
sion -lodbc32 -lodbccp32 -lcomctl32
   libc=, so=dll, useshrplib=true, libperl=libperl516.a
   gnulibc_version=''
 Dynamic Linking:
   dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
   cccdlflags=' ', 
lddlflags='-mdll -s -LC:\_32\strawberry516_64int\perl\lib\C

ORE -LC:\_32\strawberry516_64int\c\lib'


Characteristics of this binary (from libperl):
 Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
   PERLIO_LAYERS PERL_DONT_CREATE_GVSV
   PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
   PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
   USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
   USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
   USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
 Built under MSWin32
 Compiled at May 22 2012 21:11:55
 %ENV:
   PERL_JSON_BACKEND=JSON::XS
   PERL_YAML_BACKEND=YAML
 @INC:
   C:/_32/strawberry516_64int/perl/site/lib
   C:/_32/strawberry516_64int/perl/vendor/lib
   C:/_32/strawberry516_64int/perl/lib
   .


Cheers,
Rob



Re: MSYS package for Strawberry Perl

2012-09-06 Thread chm

On 9/5/2012 4:59 PM, Mark Dootson wrote:


As Rob says, I'm fairly sure it doesn't matter.

But if it does, an MSYS environment that is a copy of the environment
used to build the compiler used in Strawberry (same versions of
everything) is available at

https://sourceforge.net/projects/perlmingw/files/MSYS%20Environment%20for%20End%20Users/


Thanks, Mark.

I think this is was I was looking for.  I'm trying to get
a developers build of PDL for SP as automatic as I can.
Adding MSYS to support the build of autoconf packages might
take things the rest of the way home for PDL+SP on win32.

--Chris



On 05/09/2012 20:22, Sisyphus wrote:


- Original Message - From: chm devel.chm...@gmail.com
To: kmx k...@atlas.cz; Sisyphus sisyph...@optusnet.com.au
Cc: win32-vanilla@perl.org
Sent: Thursday, September 06, 2012 3:52 AM
Subject: MSYS package for Strawberry Perl



Hi Rob and kmx-

I finally got around to setting up an MSYS
install for my windows/SPP work and it was
really nice to finally be able to build a
bunch of those autoconf libraries for SPP
and PDL.

The catch was that the MSYS was builts with
on version of the MinGW toolchain from the
one in Strawberry Perl and SPP. I think there
would be a great simplification of configuration
and reduction in possible version skew if we
could have an MSYS built from/with the MinGW
toolchain of SP.


Chris, my experience has always been that it doesn't matter what
toolchain built my MSYS.

The MSYS that I currently use was provided with my download of
mingw.org's gcc-4.5.2 compiler.
Within that shell I've used a variety of mingw compilers to build
numerous libraries - both 32-bit and 64-bit (and including the current
Strawberry compilers). And that has not thrown up any problems.
Of course, I do strike problems from time to time, but I haven't struck
any problems related to the tool chain that built MSYS.

Is there a specific example that you can relate ?

Cheers,
Rob





-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2437/5250 - Release Date: 09/05/12






Re: Odd output with 5.16.0, x86-64int architecture

2012-09-06 Thread Sisyphus


- Original Message - 
From: Sisyphus sisyph...@optusnet.com.au

To: win32-vanilla@perl.org
Sent: Friday, September 07, 2012 1:00 AM
Subject: Odd output with 5.16.0, x86-64int architecture



Hi,

Here's the demo (Inline::C) script:

###
use warnings;
use Config;
use Math::MPFR qw(:mpfr);

use Inline C = Config =
   CCFLAGS = -D__USE_MINGW_ANSI_STDIO=1  . $Config{ccflags},
   BUILD_NOISY = 1;

use Inline C = 'EOC';

#include stdio.h
#include stdlib.h
#include math.h

void check(char * in, SV * digits) {
dXSARGS;
long double ld;
char *ptr, *buffer;;

ld = strtold(in, ptr);

buffer = malloc(32 * sizeof(char));
sprintf(buffer, %.*Le, SvUV(digits) - 1, ld);
ST(0) = sv_2mortal(newSVpv(buffer, 0));
free(buffer);
XSRETURN(1);

}

EOC

print check('1e-37', 18), \n;
###

For both the x86 and x64 builds of Strawberry Perl-5.16.0 that script 
correctly outputs:

1.0e-037

But for the x86-64int build of Strawberry Perl-5.16.0 I'm getting:
-0.0e+000


Duh - it's just that I need to cast SvUV(digits) to an unsigned long:

sprintf(buffer, %.*Le, (unsigned long)SvUV(digits) - 1, ld);

Cheers,
Rob