Skip Menu |

This queue is for tickets about the Math-GMPz CPAN distribution.

Report information
The Basics
Id: 46603
Status: resolved
Priority: 0/
Queue: Math-GMPz

People
Owner: Nobody in particular
Requestors: bobjkuo [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: v. 0.27 Rmpz_get_d_2exp first argument differ in signedness
Date: Tue, 2 Jun 2009 03:19:13 -0500
To: bug-Math-GMPz [...] rt.cpan.org
From: Bob Kuo <bobjkuo [...] gmail.com>
Short version: The function Rmpz_get_d_2exp in GMPz.xs starting on line 359 calls mpz_get_d_2exp on line 365 which, according to the GMP manual (4.3.0, page 37), takes as its first argument an unsigned long. Removing the modified "unsigned" from line 362 removes the warning. This change can be seen and commented on at http://github.com/bubaflub/Math--GMPz/commit/398dbee4341ace1bea52c54f7bc07ec816ac7805. Long version: uname -a Darwin robert-kuos-macbook-pro-2.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386 perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level uname='darwin b02.apple.com 9.0 darwin kernel version 9.3.0: tue aug 12 17:18:07 pdt 2008; root:xnu-1228.5.90~13release_i386 i386 ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc -mmacosx-version-min=10.5.7', ldflags ='-arch ppc -arch i386 -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch ppc -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Locally applied patches: fix for regcomp CVE-2007-5116 security vulnerability fix for double-free CVE-2008-1927 security vulnerability /Library/Perl/Updates/<version> comes before system perl directories installprivlib and installarchlib points to the Updates directory Built under darwin Compiled at Mar 11 2009 16:09:08 @INC: /Library/Perl/Updates/5.8.8/darwin-thread-multi-2level /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 . gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. gmp (from MacPorts) - gmp @4.2.4_1+universal Math::GMPz - v0.27 (with modifications to the Makefile.PL, see http://github.com/bubaflub/Math--GMPz/commit/cb22b3a959c346032f0a7d1516d5e897045f6cda for changes)

Message body is not shown because sender requested not to inline it.

On Tue Jun 02 04:19:39 2009, bobjkuo@gmail.com wrote: Show quoted text
> Removing the > modified "unsigned" from line 362 removes the warning.
It probably doesn't matter greatly, but I'd rather leave the "unsigned" there - as that's what it is. Does the attached patch also remove the warning ? If so, then I'd prefer to go with that patch. If not, then we'll remove the "unsigned" as you suggest (but I'll still take the opportunity to get rid of 'expptr', as it's not really needed). Cheers, Rob
--- GMPz.xs Tue Jun 2 20:29:19 2009 +++ GMPz.xs_new Tue Jun 2 20:29:33 2009 @@ -359,10 +359,9 @@ void Rmpz_get_d_2exp(mpz_t * n) { dXSARGS; double d; - unsigned long exp, *expptr; + unsigned long exp; - expptr = &exp; - d = mpz_get_d_2exp(expptr, *n); + d = mpz_get_d_2exp(&exp, *n); // sp = mark; // not needed EXTEND(SP, 2);
Subject: Re: [rt.cpan.org #46603] v. 0.27 Rmpz_get_d_2exp first argument differ in signedness
Date: Tue, 2 Jun 2009 11:41:00 -0500
To: bug-Math-GMPz [...] rt.cpan.org
From: Bob Kuo <bobjkuo [...] gmail.com>
Show quoted text
> > It probably doesn't matter greatly, but I'd rather leave the "unsigned" > there - as that's what it is. Does the attached patch also remove the > warning ?
No, after applying the patch and running make clean, perl ... Makefile.PL, sudo make I get the following error twice in the output: MPz.xs: In function ‘Rmpz_get_d_2exp’: GMPz.xs:364: warning: pointer targets in passing argument 1 of ‘__gmpz_get_d_2exp’ differ in signedness Show quoted text
> > If so, then I'd prefer to go with that patch. If not, then we'll remove > the "unsigned" as you suggest (but I'll still take the opportunity to > get rid of 'expptr', as it's not really needed).
Getting rid of expptr and unsigned throws no warnings for my machine. Show quoted text
> > Cheers, > Rob >
On Tue Jun 02 12:41:20 2009, bobjkuo@gmail.com wrote: Show quoted text
> Getting rid of expptr and unsigned throws no warnings for my machine.
Then that's what we'll do. I was mistaken, in any case - when I double-check, I find both the documentation and the code clearly show that exp is a 'long', not an 'unsigned long'. Hence the warning. (Duh!) Thanks, Bob. Cheers, Rob
Fixed with release of Math-GMPz-0.28.