Opened 10 years ago

Last modified 7 years ago

#13948 closed defect

Let MPIR build with Clang — at Version 5

Reported by: Jean-Pierre Flori Owned by: Leif Leonhardy
Priority: blocker Milestone: sage-5.12
Component: packages: standard Keywords: spkg mpir clang
Cc: Leif Leonhardy, John Palmieri Merged in:
Authors: Reviewers:
Report Upstream: Reported upstream. Developers acknowledge bug. Work issues:
Branch: Commit:
Dependencies: #13137 Stopgaps:

Status badges

Description (last modified by Leif Leonhardy)

See #13137 (or, more precisely, comment:ticket:13137:67 ff.).


One issue with clang is that simply MPIR's configure bails out (because it "thinks" we were using some broken version of GCC), which is an upstream bug (up to and including MPIR 2.6.0).

Another thing is how we (meanwhile) treat clang in Sage's spkg-install for MPIR (see comment:ticket:13137:67).

Change History (5)

comment:1 Changed 10 years ago by Leif Leonhardy

Dependencies: #13137
Owner: changed from tbd to Leif Leonhardy

comment:2 Changed 10 years ago by Leif Leonhardy

Pinging myself... ;-)

(I do have a trivial patch to acinclude.m4 to make MPIR configure [and of course build and pass its test suite] with clang. Haven't yet submitted it upstream either IIRC.)

comment:3 in reply to:  2 Changed 9 years ago by Leif Leonhardy

Replying to leif:

(I do have a trivial patch to acinclude.m4 to make MPIR configure [and of course build and pass its test suite] with clang. Haven't yet submitted it upstream either IIRC.)

I thinkTM this is the resulting patch to configure (resulting from patching acinclude.m4 in two places):

  • mpir-2.6.0/configure

     
    51325132  rm -f conftest* a.out b.out a.exe a_out.exe
    51335133  cat >conftest.c <<EOF
    51345134/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
    5135 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     5135#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
    51365136int __attribute__((noinline))
    51375137foo(int i)
    51385138{
     
    55885588   Extracted from tests/mpn/t-iord_u.c.  Causes Apple's gcc 3.3 build 1640 and
    55895589   1666 to segfault with e.g., -O2 -mpowerpc64.  */
    55905590
    5591 #ifdef __GNUC__
     5591#if     defined(__GNUC__) && !defined(__clang__)
    55925592typedef unsigned long long t1;typedef t1*t2;
    55935593__inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
    55945594{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
     
    63936393  rm -f conftest* a.out b.out a.exe a_out.exe
    63946394  cat >conftest.c <<EOF
    63956395/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
    6396 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     6396#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
    63976397int __attribute__((noinline))
    63986398foo(int i)
    63996399{
     
    68496849   Extracted from tests/mpn/t-iord_u.c.  Causes Apple's gcc 3.3 build 1640 and
    68506850   1666 to segfault with e.g., -O2 -mpowerpc64.  */
    68516851
    6852 #ifdef __GNUC__
     6852#if     defined(__GNUC__) && !defined(__clang__)
    68536853typedef unsigned long long t1;typedef t1*t2;
    68546854__inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
    68556855{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}

comment:4 Changed 9 years ago by Leif Leonhardy

And that's the corresponding one against upstream's acinclude.m4:

  • mpir-2.6.0/acinclude.m4

     
    480480# first see a simple "main()" works, then go on to other checks
    481481GMP_PROG_CC_WORKS_PART([$1], [])
    482482
    483 GMP_PROG_CC_WORKS_PART_MAIN([$1], [gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags],
    484 [/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
    485 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     483GMP_PROG_CC_WORKS_PART_MAIN([$1], [gcc-4.3.2 on 64-bit is bad, try -O1 or -fno-strict-aliasing for the flags],
     484[/* The following aborts with gcc-4.3.2 on a 64-bit system which is an unusable compiler */
     485#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
    486486int __attribute__((noinline))
    487487foo(int i)
    488488{
     
    566566GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
    567567[/* The following provokes a segfault in the compiler on powerpc-apple-darwin.
    568568   Extracted from tests/mpn/t-iord_u.c.  Causes Apple's gcc 3.3 build 1640 and
    569    1666 to segfault with e.g., -O2 -mpowerpc64. */
     569   1666 to segfault with, e.g., -O2 -mpowerpc64. */
    570570
    571 #ifdef __GNUC__
     571#if     defined(__GNUC__) && !defined(__clang__)
    572572typedef unsigned long long t1;typedef t1*t2;
    573573__inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
    574574{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}

comment:5 Changed 9 years ago by Leif Leonhardy

Description: modified (diff)
Note: See TracTickets for help on using tickets.