Ticket #13948: mpir-2.6.0.p3.diff

File mpir-2.6.0.p3.diff, 8.3 KB (added by jdemeyer, 9 years ago)
  • SPKG.txt

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1380643869 -7200
    # Node ID a54f539bb849b6f33da22bde6a11f963559073cd
    # Parent  f00092ff9d86d72e16d6e90feb5e6aac076c4e3b
    Trac #13948: fix various configure tests which break with Clang
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    5353   Patches `configure`, `acinclude.m4` and `configure.in`; to be applied
    5454   *after* `patches/configure.patch` (which its name should currently make
    5555   sure).  Submitted upstream (against MPIR 2.6.0; 26.02.2013).
     56 * clang-config.patch: remove one broken configure test and fix one test
     57   for Clang, see http://trac.sagemath.org/ticket/13948
    5658 * mpz__t-scan-bugfix.patch: fix trivial bug in `tests/mpz/t-scan.c` leading
    5759   to a segfault (during the test suite) with newer GCC versions.
    5860   Submitted upstream (against MPIR 2.6.0; 02.04.2013).
     
    6062
    6163== Changelog ==
    6264
     65=== mpir-2.6.0.p3 (Jeroen Demeyer, 2 October 2013) ===
     66 * #13948: clang-config.patch: fix configure script for Clang.
     67
    6368=== mpir-2.6.0.p2 (Leif Leonhardy, April 3rd 2013) ===
    6469 * #14399: MPIR 2.6.0's test suite fails with GCC 4.8.0
    6570   Rather surprisingly, this bug, now causing a segfault in MPIR's test suite,
  • new file patches/clang-config.patch

    diff --git a/patches/clang-config.patch b/patches/clang-config.patch
    new file mode 100644
    - +  
     1diff -ru src/acinclude.m4 b/acinclude.m4
     2--- src/acinclude.m4    2012-10-23 16:56:46.000000000 +0200
     3+++ b/acinclude.m4      2013-10-02 09:22:41.958758575 +0200
     4@@ -480,29 +480,6 @@
     5 # first see a simple "main()" works, then go on to other checks
     6 GMP_PROG_CC_WORKS_PART([$1], [])
     7 
     8-GMP_PROG_CC_WORKS_PART_MAIN([$1], [gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags],
     9-[/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
     10-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     11-int __attribute__((noinline))
     12-foo(int i)
     13-{
     14-  int *p = __builtin_malloc (4 * sizeof(int));
     15-  *p = 0;
     16-  p[i] = 1;
     17-  return *p;
     18-}
     19-extern void abort (void);
     20-int main()
     21-{
     22-   if (foo(0) != 1)
     23-        abort ();
     24-        return 0;
     25-}
     26-#else
     27-int main(){return 0;}
     28-#endif
     29-])
     30-
     31 GMP_PROG_CC_WORKS_PART([$1], [function pointer return],
     32 [/* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
     33    (without -maix64), hence detecting an unusable compiler */
     34@@ -570,6 +547,10 @@
     35 
     36 #ifdef __GNUC__
     37 typedef unsigned long long t1;typedef t1*t2;
     38+/* Clang fails to link this on XCode 5 unless static is added */
     39+#ifdef __clang__
     40+static
     41+#endif
     42 __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
     43 {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;}
     44 f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
     45diff -ru src/configure b/configure
     46--- src/configure       2012-11-08 23:13:27.000000000 +0100
     47+++ b/configure 2013-10-02 09:22:56.458758077 +0200
     48@@ -5131,74 +5131,6 @@
     49   # remove anything that might look like compiler output to our "||" expression
     50   rm -f conftest* a.out b.out a.exe a_out.exe
     51   cat >conftest.c <<EOF
     52-/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
     53-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     54-int __attribute__((noinline))
     55-foo(int i)
     56-{
     57-  int *p = __builtin_malloc (4 * sizeof(int));
     58-  *p = 0;
     59-  p[i] = 1;
     60-  return *p;
     61-}
     62-extern void abort (void);
     63-int main()
     64-{
     65-   if (foo(0) != 1)
     66-        abort ();
     67-        return 0;
     68-}
     69-#else
     70-int main(){return 0;}
     71-#endif
     72-
     73-EOF
     74-  echo "Test compile: gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags" >&5
     75-  gmp_compile="$cc $cflags $cppflags conftest.c >&5"
     76-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
     77-  (eval $gmp_compile) 2>&5
     78-  ac_status=$?
     79-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     80-  test $ac_status = 0; }; then
     81-    cc_works_part=yes
     82-    if test "$cross_compiling" = no; then
     83-      if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
     84-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
     85-  (eval $ac_try) 2>&5
     86-  ac_status=$?
     87-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     88-  test $ac_status = 0; }; }; then :;
     89-      else
     90-        cc_works_part=norun
     91-      fi
     92-    fi
     93-  else
     94-    cc_works_part=no
     95-  fi
     96-  if test "$cc_works_part" != yes; then
     97-    echo "failed program was:" >&5
     98-    cat conftest.c >&5
     99-  fi
     100-  rm -f conftest* a.out b.out a.exe a_out.exe
     101-  case $cc_works_part in
     102-    yes)
     103-
     104-      ;;
     105-    no)
     106-      gmp_prog_cc_works="no, gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags"
     107-      ;;
     108-    norun)
     109-      gmp_prog_cc_works="no, gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags, program does not run"
     110-      ;;
     111-  esac
     112-fi
     113-
     114-
     115-
     116-if test "$gmp_prog_cc_works" = yes; then
     117-  # remove anything that might look like compiler output to our "||" expression
     118-  rm -f conftest* a.out b.out a.exe a_out.exe
     119-  cat >conftest.c <<EOF
     120 /* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
     121    (without -maix64), hence detecting an unusable compiler */
     122 void *g() { return (void *) 0; }
     123@@ -5590,6 +5522,10 @@
     124 
     125 #ifdef __GNUC__
     126 typedef unsigned long long t1;typedef t1*t2;
     127+/* Clang fails to link this on XCode 5 unless static is added */
     128+#ifdef __clang__
     129+static
     130+#endif
     131 __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
     132 {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;}
     133 f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
     134@@ -6392,74 +6328,6 @@
     135   # remove anything that might look like compiler output to our "||" expression
     136   rm -f conftest* a.out b.out a.exe a_out.exe
     137   cat >conftest.c <<EOF
     138-/* The following aborts with gcc-4.3.2 on a 64bit system which is an unusable compiler */
     139-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     140-int __attribute__((noinline))
     141-foo(int i)
     142-{
     143-  int *p = __builtin_malloc (4 * sizeof(int));
     144-  *p = 0;
     145-  p[i] = 1;
     146-  return *p;
     147-}
     148-extern void abort (void);
     149-int main()
     150-{
     151-   if (foo(0) != 1)
     152-        abort ();
     153-        return 0;
     154-}
     155-#else
     156-int main(){return 0;}
     157-#endif
     158-
     159-EOF
     160-  echo "Test compile: gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags" >&5
     161-  gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
     162-  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
     163-  (eval $gmp_compile) 2>&5
     164-  ac_status=$?
     165-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     166-  test $ac_status = 0; }; then
     167-    cc_works_part=yes
     168-    if test "$cross_compiling" = no; then
     169-      if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
     170-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
     171-  (eval $ac_try) 2>&5
     172-  ac_status=$?
     173-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     174-  test $ac_status = 0; }; }; then :;
     175-      else
     176-        cc_works_part=norun
     177-      fi
     178-    fi
     179-  else
     180-    cc_works_part=no
     181-  fi
     182-  if test "$cc_works_part" != yes; then
     183-    echo "failed program was:" >&5
     184-    cat conftest.c >&5
     185-  fi
     186-  rm -f conftest* a.out b.out a.exe a_out.exe
     187-  case $cc_works_part in
     188-    yes)
     189-
     190-      ;;
     191-    no)
     192-      gmp_prog_cc_works="no, gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags"
     193-      ;;
     194-    norun)
     195-      gmp_prog_cc_works="no, gcc-4.3.2 on 64bit is bad , try -O1 or -fno-strict-aliasing for the flags, program does not run"
     196-      ;;
     197-  esac
     198-fi
     199-
     200-
     201-
     202-if test "$gmp_prog_cc_works" = yes; then
     203-  # remove anything that might look like compiler output to our "||" expression
     204-  rm -f conftest* a.out b.out a.exe a_out.exe
     205-  cat >conftest.c <<EOF
     206 /* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
     207    (without -maix64), hence detecting an unusable compiler */
     208 void *g() { return (void *) 0; }
     209@@ -6851,6 +6719,10 @@
     210 
     211 #ifdef __GNUC__
     212 typedef unsigned long long t1;typedef t1*t2;
     213+/* Clang fails to link this on XCode 5 unless static is added */
     214+#ifdef __clang__
     215+static
     216+#endif
     217 __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
     218 {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;}
     219 f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;