NetBSD Problem Report #51788

From hf@spg.tu-darmstadt.de  Fri Jan  6 15:04:02 2017
Return-Path: <hf@spg.tu-darmstadt.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 614357A16E
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  6 Jan 2017 15:04:02 +0000 (UTC)
Message-Id: <201701061502.v06F2rsQ008609@Gstoder.nt.e-technik.tu-darmstadt.de>
Date: Fri, 6 Jan 2017 16:02:53 +0100 (CET)
From: Hauke Fath <hf@spg.tu-darmstadt.de>
Reply-To: Hauke Fath <hf@spg.tu-darmstadt.de>
To: gnats-bugs@NetBSD.org
Cc: Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: devel/gmp build fails in configure phase
X-Send-Pr-Version: 3.95

>Number:         51788
>Category:       pkg
>Synopsis:       devel/gmp build fails in configure phase
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 06 15:05:00 +0000 2017
>Last-Modified:  Sat Jan 07 02:10:00 +0000 2017
>Originator:     Hauke Fath
>Release:        NetBSD 7.99.50
>Organization:
Technische Universitaet Darmstadt
>Environment:


System: NetBSD Gstoder 7.99.50 NetBSD 7.99.50 (MONOLITHIC) #0: Fri Dec 16 15:07:39 CET 2016 hf@Hochstuhl:/var/obj/netbsd-builds/developer/i386/sys/arch/i386/compile/MONOLITHIC i386
Architecture: i386
Machine: i386
>Description:

	The devel/gmp build fails early with

[...]
===> Configuring for gmp-6.1.2
cd /var/obj/pkgsrc/devel/gmp/work/gmp-6.1.2 && type autoconf && autoconf
autoconf is /var/obj/pkgsrc/devel/gmp/work/.tools/bin/autoconf
=> Modifying GNU configure scripts to avoid --recheck
=> Replacing config-guess with pkgsrc versions
=> Replacing config-sub with pkgsrc versions
=> Replacing install-sh with pkgsrc version
=> Checking for portability problems in extracted files
checking build system type... i486--netbsdelf
checking host system type... i486--netbsdelf
checking for a BSD-compatible install... /usr/bin/install -c -o hf -g spgmit
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... /usr/bin/awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=32
checking compiler gcc -O2 ... no, mpn_lshift_com optimization 2, program does not run
configure: error: could not find a working compiler, see config.log for details
*** Error code 1


	The config.log has

[...]
Test compile: mpn_lshift_com optimization 2
configure:6805: gcc -O2  conftest.c >&5
configure:6808: $? = 0
configure:6813: ./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest
[1]   Abort trap (core dumped) ./a.out
eval: ./b.out: not found
eval: ./a.exe: not found
eval: ./a_out.exe: not found
eval: ./conftest: not found
configure:6816: $? = 127
failed program was:
/* The following is mis-compiled by Intel ia-64 icc version 1.8 under
    "icc -O3",  After several calls, the function writes partial garbage to
    the result vector.  Perhaps relates to the chk.a.nc insn.  This code needs
    to be run to show the problem, but that's fine, the offending cc is a
    native-only compiler so we don't have to worry about cross compiling.  */

#if ! defined (__cplusplus)
#include <stdlib.h>
void
lshift_com (rp, up, n, cnt)
  unsigned long *rp;
  unsigned long *up;
  long n;
  unsigned cnt;
{
  unsigned long high_limb, low_limb;
  unsigned tnc;
  long i;
  up += n;
  rp += n;
  tnc = 8 * sizeof (unsigned long) - cnt;
  low_limb = *--up;
  high_limb = low_limb << cnt;
  for (i = n - 1; i != 0; i--)
    {
      low_limb = *--up;
      *--rp = ~(high_limb | (low_limb >> tnc));
      high_limb = low_limb << cnt;
    }
  *--rp = ~high_limb;
}
int
main ()
{
  unsigned long *r, *r2;
  unsigned long a[88 + 1];
  long i;
  for (i = 0; i < 88 + 1; i++)
    a[i] = ~0L;
  r = malloc (10000 * sizeof (unsigned long));
  r2 = r;
  for (i = 0; i < 528; i += 23)
    {
      lshift_com (r2, a,
                  i / (8 * sizeof (unsigned long)) + 1,
                  i % (8 * sizeof (unsigned long)));
      r2 += 88 + 1;
    }
  if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 ||
      r[2052] != 0 || r[2053] != 0 || r[2054] != 0)
    abort ();
  free (r);
  return 0;
}
#else
int
main ()
{
  return 0;
}
#endif

configure:6962: result: no, mpn_lshift_com optimization 2, program does not run
configure:7200: error: could not find a working compiler, see config.log for details
[...]



>How-To-Repeat:

	Build devel/gmp on NetBSD-current/i386, find you cannot.


>Fix:

	No idea.



>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51788: devel/gmp build fails in configure phase
Date: Sat, 7 Jan 2017 02:06:51 +0000

 On Fri, Jan 06, 2017 at 03:05:00PM +0000, Hauke Fath wrote:
  > 	The devel/gmp build fails early with
  > [...]

 I guess the first question is: does it work with -O1?

 -- 
 David A. Holland
 dholland@netbsd.org

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.