Test t-tdiv aborts (6.0.0a)

Ludwig, Mark ludwig.mark at siemens.com
Thu Mar 26 16:09:48 UTC 2015

> On Thursday, March 26, 2015 5:49 AM, Torbjörn wrote:
> "Ludwig, Mark" <ludwig.mark at siemens.com> writes:
>   Greetings,
>   I am working to bootstrap GCC on Solaris, and having trouble with GMP 6.0.0a.
>   The failure is in check-TESTS in directory mpz:
>   bash: line 5: 17152 Segmentation Fault      (core dumped) ${dir}$tst
>   FAIL: t-tdiv
>   Traceback from dbx:
>   > dbx t-tdiv core
>   program terminated by signal SEGV (no mapping at the fault address) (fault
> address is just beyond end of stack)
>   0x0001b620: __gmpn_mul+0x0228:  ld       [%l6], %i3
>   (dbx) t
>   =>[1] __gmpn_mul(0xffbfad98, 0xffbfb308, 0x8e7, 0x0, 0xfffffa11, 0xffffe844),
> at 0x1b620
>     [2] __gmpn_dcpi1_divappr_q(0x1, 0xffbfe284, 0xffbfbee8, 0xffbfb308,
> 0xffbfb308, 0xffbfcc78), at 0x38dd4
>     [3] __gmpn_div_q(0xffffffff, 0x10ddc4, 0x0, 0xffbfb308, 0x1ff, 0xffffffff), at
> 0x209d0
>     [4] __gmpz_tdiv_q(0xffbfef44, 0xffbfef74, 0x10000, 0x9b35c, 0x83a14,
> 0x2f7), at 0x1841c
>     [5] main(0xffbfef68, 0xffbfef74, 0xffbfef50, 0xace4, 0xffbfef5c, 0xffbfef80),
> at 0x13260
>   (dbx)
>   Configured with:
>   CC=cc CXX=CC ./configure --enable-cxx --build=sparc-sun-solaris2.10
>   > cc -V
>   cc: Sun C 5.12 SunOS_sparc 2011/11/16
>   > uname -a
>   SunOS myhost 5.10 Generic_Virtual sun4v sparc sun4v
>   > ./config.guess
>   ultrasparc-sun-solaris2.10
>   > ./configfsf.guess
>   sparc-sun-solaris2.10
>   Note that I am explicitly using the 32-bit form, because the GCC bootstrap
>   recommendation is to use 32-bit.
> Did you pass ABI=32 somehow, but forgot to show it above?  Using the
> --build argument in the hope that it will restrict the ABI choices is
> not supported.
> I have no idea if that is related to the present problem.

I was not aware I needed to be explicit about the ABI.  It
was reported in the configure output, and I thought that was
sufficient.  I thought by choosing "sparc-sun-solaris2.10"
and not "sparc64-sun-solaris2.10," I was being explicit
about it, actually, but then I know that the Solaris Studio
compiler defaults to 32-bit.  I imagine you are more
familiar with GCC, and I wonder if it would default to
64-bit.  Anyway, the bug reporting guidelines did not
specify to include any of the configure output, but I
imagine this section is what you would find interesting:

using ABI="32"
      CC="cc -D_STDC_C99="
      CFLAGS=" -xO4 -xchip=generic"
      CXXFLAGS=" -xO4 -xchip=generic"
      MPN_PATH=" sparc32 generic"

Now, configuring with:

CC=cc CXX=CC ./configure --enable-cxx --build=sparc-sun-solaris2.10 CFLAGS=-xO3 ABI=32 

It reports:

using ABI="32"
      CC="cc -D_STDC_C99="
      MPN_PATH=" sparc32 generic"

>   I sort of assume this is exposing a subtle compiler bug, but need help working
>   around it or whatever.  Since all I want to do is bootstrap GCC with this (not
>   use it for any general computations), I suppose it's possible I can ignore this
>   particular failure, but I have no idea which parts of GMP get exercised in GCC
>   under what conditions.  Once I get GCC bootstrapped, I intend to rebuild GMP
>   using the bootstrapped GCC, because I have the impression that will generate a
>   64-bit version of GCC, which is what I want, ultimately.
> This is what I'll do:
> 1. Try to find an older gcc, use that.
> 2. Try "configure ABI=32 && make && make check" and see if that works
> 3. Pass explicit CFLAGS.  Start with the value GMP figures out (see
>    perhaps 30 lines down the "configure" output) and change them to see
>    if you can avoid the compiler bug.  Changing -O2 to -O1 might be an
>    initial attempt.

As noted above, it was defaulting to level 4 optimization.
I knocked it down to level 3, and, while it's still running,
it's past the t-tdiv check, which passed.

I started my career in the numerical computing world, where
optimization both matters for performance and has been known
to cause problems (such as this, apparently).  Sorry I
didn't think to crank down the optimization.  (I also have
no idea what the -xchip=generic option does, so for all I
know, removing that would have solved this too....)

Anyway, I'm past this problem.


BTW, to get here, I had to hack the configure script to make
it properly detect problems when it checked things.
Specifically, it fails to detect that __attribute__ ((mode
(XX))) does not work with the Solaris Studio compiler, and
this caused a warning in almost every compilation.  I don't
like warnings, so I fixed configure.  I will post that
change as a separate bug, after I've successfully
boot-strapped GCC.


> 4. Cross compile from a known-good compiler.
> --
> Torbjörn
> Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list