Skip Menu |

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

Report information
The Basics
Id: 87041
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Math-Int128

People
Owner: Nobody in particular
Requestors: d.thomas [...] its.uq.edu.au
Cc:
AdminCc:

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



Subject: doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings
NB using locally built perl-5.16.3 (without threads) root@noble$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.4 (Santiago) root@noble$ cc --version --verbose 2>&1 cc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) Copyright (C) 2010 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. root@noble$ gcc --version --verbose 2>&1 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) Copyright (C) 2010 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. changing line 35 of Makefile.PL to unless ($cc_version =~ /^g?cc\s+\(GCC\)\s+(4\.(\d+)\S*)/im and $2 >= 4) { NB I don't have ready access to clang/llvm which has become the first practical alternative to gcc and is now the default compiler on OSX & FreeBSD. I don't have acess to clang/llvm include files but googling "llvm __int128_t" suggests it has been supported for a while http://llvm.org/bugs/show_bug.cgi?id=9659 root@noble$ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Math::Int128 Writing MYMETA.yml and MYMETA.json GNU C compiler version 4.4.7 found, good! "make test" PASSes Submitted patch which silences all but warning in strtoint128.h. Applying that initialization of upper_mul_limit results in t/Math-Int128.t ... No subtests run t/Math-UInt128.t .. No subtests run Anyway, all tests PASS after applying patch. NB there were a similar set of warnings with Math::Int64 I don't think it's actually used, but both Math-UInt128.t and Math-Int128.t start "#!/usr/bin/perl" which is certainly NOT the perl I'm building against. Bonus points for pod tests being author-only
Subject: Math-Int128-0.11.patch
diff -u Math-Int128-0.11.orig/Int128.xs Math-Int128-0.11/Int128.xs --- Math-Int128-0.11.orig/Int128.xs 2013-07-18 16:52:14.000000000 +1000 +++ Math-Int128-0.11/Int128.xs 2013-07-19 18:01:22.923496286 +1000 @@ -121,10 +121,12 @@ static char *sub_error = "Subtraction overflows"; static char *inc_error = "Increment operation wraps"; static char *dec_error = "Decrement operation wraps"; +#if 0 /* prevent 4 cases of "‘xxxxx’ defined but not used" */ static char *left_b_error = "Left-shift right operand is out of bounds"; static char *left_error = "Left shift overflows"; static char *right_b_error = "Right-shift right operand is out of bounds"; static char *right_error = "Right shift overflows"; +#endif static char *div_by_0_error = "Illegal division by zero"; static void croak_string(pTHX_ const char *str) { @@ -200,6 +202,7 @@ return si128; } croak_string(aTHX_ "internal error: reference to int128_t expected"); + return 0; /* silence gcc "control reaches end of non-void function" */ } static SV * @@ -210,6 +213,7 @@ return su128; } croak_string(aTHX_ "internal error: reference to uint128_t expected"); + return 0; /* silence gcc "control reaches end of non-void function" */ } #define SvI128x(sv) SvI128Y(SvSI128(aTHX_ sv)) @@ -878,7 +882,7 @@ CODE: if (may_die_on_overflow) { int neg = 0; - uint128_t a, b, rl, rh; + uint128_t a, b; /* , rl, rh; */ if (a1 < 0) { a = -a1; neg ^= 1; @@ -1256,8 +1260,8 @@ SV * mi128_string(self, ...) SV *self -PREINIT: - STRLEN len; +# PREINIT: +# STRLEN len; CODE: RETVAL = newSV(I128STRLEN); SvPOK_on(RETVAL); @@ -1476,7 +1480,7 @@ SV *other SV *rev PREINIT: - int sign; +# int sign; uint128_t r; int128_t a, b; CODE: @@ -1693,8 +1697,8 @@ SV * mu128_string(self, ...) SV *self -PREINIT: - STRLEN len; +# PREINIT: +# STRLEN len; CODE: RETVAL = newSV(I128STRLEN); SvPOK_on(RETVAL); @@ -1761,7 +1765,7 @@ CODE: if (may_die_on_overflow) { int neg = 0; - uint128_t a, b, rl, rh; + uint128_t a, b; /* , rl, rh; */ if (a1 < 0) { a = -a1; neg ^= 1; Common subdirectories: Math-Int128-0.11.orig/benchmarks and Math-Int128-0.11/benchmarks diff -u Math-Int128-0.11.orig/c_api.h Math-Int128-0.11/c_api.h --- Math-Int128-0.11.orig/c_api.h 2012-09-10 21:21:21.000000000 +1000 +++ Math-Int128-0.11/c_api.h 2013-07-19 17:59:57.530721220 +1000 @@ -14,14 +14,14 @@ static void init_c_api(pTHX) { HV *hv = get_hv("Math::Int128::C_API", TRUE|GV_ADDMULTI); - hv_store(hv, "min_version", 11, newSViv(1), 0); - hv_store(hv, "max_version", 11, newSViv(1), 0); - hv_store(hv, "SvI128", 6, newSViv(PTR2IV(&SvI128)), 0); - hv_store(hv, "SvI128OK", 8, newSViv(PTR2IV(&SvI128OK)), 0); - hv_store(hv, "SvU128", 6, newSViv(PTR2IV(&SvU128)), 0); - hv_store(hv, "SvU128OK", 8, newSViv(PTR2IV(&SvU128OK)), 0); - hv_store(hv, "newSVi128", 9, newSViv(PTR2IV(&newSVi128)), 0); - hv_store(hv, "newSVu128", 9, newSViv(PTR2IV(&newSVu128)), 0); + (void) hv_store(hv, "min_version", 11, newSViv(1), 0); + (void) hv_store(hv, "max_version", 11, newSViv(1), 0); + (void) hv_store(hv, "SvI128", 6, newSViv(PTR2IV(&SvI128)), 0); + (void) hv_store(hv, "SvI128OK", 8, newSViv(PTR2IV(&SvI128OK)), 0); + (void) hv_store(hv, "SvU128", 6, newSViv(PTR2IV(&SvU128)), 0); + (void) hv_store(hv, "SvU128OK", 8, newSViv(PTR2IV(&SvU128OK)), 0); + (void) hv_store(hv, "newSVi128", 9, newSViv(PTR2IV(&newSVi128)), 0); + (void) hv_store(hv, "newSVu128", 9, newSViv(PTR2IV(&newSVu128)), 0); } Common subdirectories: Math-Int128-0.11.orig/c_api_client and Math-Int128-0.11/c_api_client Common subdirectories: Math-Int128-0.11.orig/lib and Math-Int128-0.11/lib diff -u Math-Int128-0.11.orig/strtoint128.h Math-Int128-0.11/strtoint128.h --- Math-Int128-0.11.orig/strtoint128.h 2012-09-10 21:14:26.000000000 +1000 +++ Math-Int128-0.11/strtoint128.h 2013-07-19 18:00:22.981250266 +1000 @@ -44,7 +44,7 @@ uint128_t acc = 0; int c, neg, between = 0; - uint128_t upper_mul_limit; + uint128_t upper_mul_limit;/* = (UINT128_MAX / base); /* ??? round-up needed when base not power of 2 */ /* * Skip white space and pick up leading +/- sign if any. Common subdirectories: Math-Int128-0.11.orig/t and Math-Int128-0.11/t
Subject: Re: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings
Date: Fri, 19 Jul 2013 03:58:29 -0700 (PDT)
To: "bug-Math-Int128 [...] rt.cpan.org" <bug-Math-Int128 [...] rt.cpan.org>
From: Salvador Fandino <sfandino [...] yahoo.com>
Show quoted text
----- Original Message -----
> From: "d.thomas@its.uq.edu.au via RT" <bug-Math-Int128@rt.cpan.org> > To: > Cc: > Sent: Friday, July 19, 2013 10:33 AM > Subject: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings
It seems every vendor likes changing the way GCC reports its version. I have added support for the format you have described. Version 0.12 is now available from CPAN: https://metacpan.org/release/SALVA/Math-Int128-0.12
Subject: Re: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings
Date: Fri, 19 Jul 2013 05:05:29 -0700 (PDT)
To: "bug-Math-Int128 [...] rt.cpan.org" <bug-Math-Int128 [...] rt.cpan.org>
From: Salvador Fandino <sfandino [...] yahoo.com>
Show quoted text
----- Original Message -----
> From: "Salvador \"Fandiño\" via RT" <bug-Math-Int128@rt.cpan.org> > To: > Cc: > Sent: Friday, July 19, 2013 12:58 PM > Subject: Re: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings > >       Queue: Math-Int128 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=87041 > > > > > > > ----- Original Message -----
>> From: "d.thomas@its.uq.edu.au via RT"
> <bug-Math-Int128@rt.cpan.org>
>> To: >> Cc: >> Sent: Friday, July 19, 2013 10:33 AM >> Subject: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also
> patch to silence warnings > > It seems every vendor likes changing the way GCC reports its version. > > I have added support for the format you have described. > > Version 0.12 is now available from CPAN: > https://metacpan.org/release/SALVA/Math-Int128-0.12
oops, I didn't notice your patch, will apply it on the next version
Subject: RE: [rt.cpan.org #87041] doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings
Date: Fri, 19 Jul 2013 18:59:30 +0000
To: "bug-Math-Int128 [...] rt.cpan.org" <bug-Math-Int128 [...] rt.cpan.org>
From: Danny Thomas <d.thomas [...] its.uq.edu.au>
Show quoted text
________________________________________
>oops, I didn't notice your patch, will apply it on the next version
luckily these are mostly straightforward except the strtoint128.h one, which is definitely worth a carfeful look and maybe an explicit test. In terms of checking compiler versions, it might be better having a simple c file that checks for __int128_t functionality instead. The code would need to handle things like 4.4<=gcc<4.6.
From: d.thomas [...] its.uq.edu.au
I removed it from my initial report, but here's the options RHEL6 uses gcc -c -I. -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.12\" -DXS_VERSION=\"0.12\" -fPIC "-I/opt/perl/cis.perl-base2.rhel6-5.16.3-20130425/lib/5.16.3/x86_64-linux/CORE" Int128.c
patch applied. Thank you for reporting the issue and the patch!