PARI/GP Bug report logs - #1252
Mac OS X 'Lion' default compiler miscompiles bezout.

Package: pari; Maintainer for pari is Aurel Page <aurel.page@normalesup.org>; Source for pari is src:pari.

Reported by: Theo van den Bogaart <theo.vandenbogaart@hu.nl>

Date: Wed, 23 Nov 2011 15:18:02 UTC

Severity: normal

Done: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list@pari.math.u-bordeaux.fr, Karim.Belabas@math.u-bordeaux.fr:
Bug#1252; Package pari. (full text, mbox, link).


Acknowledgement sent to Theo van den Bogaart <theo.vandenbogaart@hu.nl>:
New Bug report received and forwarded. Copy sent to Karim.Belabas@math.u-bordeaux.fr. (full text, mbox, link).


Message #5 received at submit@pari.math.u-bordeaux.fr (full text, mbox, reply):

From: Theo van den Bogaart <theo.vandenbogaart@hu.nl>
To: "submit@pari.math.u-bordeaux.fr" <submit@pari.math.u-bordeaux.fr>
Subject: Pari's function bezout gives wrong results
Date: Wed, 23 Nov 2011 15:09:34 +0000
Package: pari
Version: 2.5.0

The function bezout applied to integers gives the wrong output. 
For very small numbers (like (4,6) or (9,14)) it works fine. 
However, for example:
  bezout(32,432)
gives
  [1,0,32].

But 32 is not the gcd --- in fact, the input gcd(32,432) does give the correct answer: 16.
A lot of other random trials (like bezout(9,20)) also result in wrong solutions. 

This is the version-information pari supplies:
                          GP/PARI CALCULATOR Version 2.5.0 (released)
                      i386 running darwin (x86-64 kernel) 64-bit version
   compiled: Nov 22 2011, gcc-4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
                        (readline v6.2 enabled, extended help enabled)
I downloaded this version yesterday (nov 22) from the Pari website.




Information forwarded to bug-submit-list@pari.math.u-bordeaux.fr, Karim.Belabas@math.u-bordeaux.fr:
Bug#1252; Package pari. (full text, mbox, link).


Acknowledgement sent to Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
Extra info received and forwarded to list. Copy sent to Karim.Belabas@math.u-bordeaux.fr. (full text, mbox, link).


Message #10 received at 1252@pari.math.u-bordeaux.fr (full text, mbox, reply):

From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
To: Theo van den Bogaart <theo.vandenbogaart@hu.nl>, 1252@pari.math.u-bordeaux.fr
Subject: Re: Bug#1252: Pari's function bezout gives wrong results
Date: Wed, 23 Nov 2011 16:45:45 +0100
On Wed, Nov 23, 2011 at 03:09:34PM +0000, Theo van den Bogaart wrote:
> Package: pari
> Version: 2.5.0
> 
> The function bezout applied to integers gives the wrong output. 
> For very small numbers (like (4,6) or (9,14)) it works fine. 
> However, for example:
>   bezout(32,432)
> gives
>   [1,0,32].
> 
> But 32 is not the gcd --- in fact, the input gcd(32,432) does give the correct answer: 16.
> A lot of other random trials (like bezout(9,20)) also result in wrong solutions. 
> 
> This is the version-information pari supplies:
>                           GP/PARI CALCULATOR Version 2.5.0 (released)
>                       i386 running darwin (x86-64 kernel) 64-bit version
>    compiled: Nov 22 2011, gcc-4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
>                         (readline v6.2 enabled, extended help enabled)
> I downloaded this version yesterday (nov 22) from the Pari website.

Hello Theo,

This is a well-known bug in OS X Lion default compiler which has been reported several
time to the PARI lists. We suggest you use GCC 4.5 which is much more reliable.
If you can report the problem to Apple, please do so.

Cheers,
Bill.



Changed Bug title. Request was from Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> to control@pari.math.u-bordeaux.fr. (full text, mbox, link).


Information forwarded to bug-submit-list@pari.math.u-bordeaux.fr, Karim.Belabas@math.u-bordeaux.fr:
Bug#1252; Package pari. (Wed, 18 Dec 2013 13:33:02 GMT) (full text, mbox, link).


Acknowledgement sent to Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
Extra info received and forwarded to list. Copy sent to Karim.Belabas@math.u-bordeaux.fr. (Wed, 18 Dec 2013 13:33:02 GMT) (full text, mbox, link).


Message #17 received at 1252@pari.math.u-bordeaux.fr (full text, mbox, reply):

From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
To: Theo van den Bogaart <theo.vandenbogaart@hu.nl>, 1252@pari.math.u-bordeaux.fr
Subject: Re: Bug#1252: Pari's function bezout gives wrong results
Date: Wed, 18 Dec 2013 14:15:43 +0100
On Wed, Nov 23, 2011 at 04:45:45PM +0100, Bill Allombert wrote:
> On Wed, Nov 23, 2011 at 03:09:34PM +0000, Theo van den Bogaart wrote:
> > Package: pari
> > Version: 2.5.0
> > 
> > The function bezout applied to integers gives the wrong output. 
> > For very small numbers (like (4,6) or (9,14)) it works fine. 
> > However, for example:
> >   bezout(32,432)
> > gives
> >   [1,0,32].
> > 
> > But 32 is not the gcd --- in fact, the input gcd(32,432) does give the correct answer: 16.
> > A lot of other random trials (like bezout(9,20)) also result in wrong solutions. 
> > 
> > This is the version-information pari supplies:
> >                           GP/PARI CALCULATOR Version 2.5.0 (released)
> >                       i386 running darwin (x86-64 kernel) 64-bit version
> >    compiled: Nov 22 2011, gcc-4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
> >                         (readline v6.2 enabled, extended help enabled)
> > I downloaded this version yesterday (nov 22) from the Pari website.
> 
> Hello Theo,
> 
> This is a well-known bug in OS X Lion default compiler which has been reported several
> time to the PARI lists. We suggest you use GCC 4.5 which is much more reliable.
> If you can report the problem to Apple, please do so.

I finally found a fix, see

<http://pari.math.u-bordeaux.fr/archives/pari-dev-1312/threads.html>

If one changes the definition of divll in src/kernel/x86_64/asm0.h

#define divll(a,b) \
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \
   __asm__ ("divq %4" \
        : "=a" /* %eax */ (__value), "=&d" /* %edx */ (hiremainder) \
                                     ^^^^^
        : "0" /* %eax */ (__arg1), "1" /* %edx */ (hiremainder), "mr" (__arg2)); \
   __value; \
})

by replacing "=&d" by "=d", then GP works fine (make test-all succeed).

Cheers,
Bill.



Reply sent to Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
You have taken responsibility. (Fri, 10 Jan 2014 15:33:01 GMT) (full text, mbox, link).


Notification sent to Theo van den Bogaart <theo.vandenbogaart@hu.nl>:
Bug acknowledged by developer. (Fri, 10 Jan 2014 15:33:01 GMT) (full text, mbox, link).


Message #22 received at 1252-done@pari.math.u-bordeaux.fr (full text, mbox, reply):

From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
To: Theo van den Bogaart <theo.vandenbogaart@hu.nl>
Cc: 1252-done@pari.math.u-bordeaux1.fr
Subject: Re: Bug#1252: Pari's function bezout gives wrong results
Date: Fri, 10 Jan 2014 16:16:48 +0100
Hello,

A number of people have reported success with the fix applied
(GIT rev 4f94c01fdac9386cc3857a98b778e9205f0a002b), so I close this report.

Sorry it took so much time!
Bill.



Bug archived. Request was from Debbugs Internal Request <allomber@math.u-bordeaux.fr> to internal_control@pari.math.u-bordeaux.fr. (Sat, 08 Feb 2014 06:24:01 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Bill Allombert <allomber@math.u-bordeaux.fr>. Last modified: Fri Apr 26 01:36:03 2024; Machine Name: pari

PARI/GP Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.