* Re: GMP and GCC 4.3.2
@ 2009-12-17 11:19 Jay Foad
2009-12-17 22:27 ` Jean Christophe Beyler
0 siblings, 1 reply; 9+ messages in thread
From: Jay Foad @ 2009-12-17 11:19 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: gcc
If it's the bug being discussed here:
http://gmplib.org/list-archives/gmp-discuss/2009-April/003717.html
... then it was reported as fixed here:
http://gcc.gnu.org/ml/gcc/2009-04/msg00562.html
Jay.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-17 11:19 GMP and GCC 4.3.2 Jay Foad
@ 2009-12-17 22:27 ` Jean Christophe Beyler
2009-12-18 2:29 ` Jie Zhang
0 siblings, 1 reply; 9+ messages in thread
From: Jean Christophe Beyler @ 2009-12-17 22:27 UTC (permalink / raw)
To: Jay Foad, Steven Bosscher, Richard Guenther; +Cc: gcc
Actually, I just finished updating my 4.3.2 to 4.3.3 and tested it and
I still have the same issue.
This seems to be a problem more than "just" 4.3.2.
Here is the test program:
#include <stdio.h>
#include <gmp.h>
int main() {
mpz_t a,b;
mpz_init_set_str(a, "10000000000", 10); // program works with 10^9, but not
// with 10^10 (10^20 > 2^64)
mpz_init_set(b, a);
mpz_mul(a, a, a);
gmp_printf("first, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b, a);
mpz_set(b, a);
mpz_mul(a, a, a);
gmp_printf("second, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b, a);
return 0;
}
We obtain:
first, in GMP mpz_mul(a,a,a) with a=10000000000 gives 100000000000000000000
second, in GMP mpz_mul(a,a,a) with a=100000000000000000000 gives
22545360131605409929222215637663717291581095979492475463214517286840718852096
Which clearly is wrong for the second output.
This was tested with a 64 bit architecture. I know that with a 4.1.1
port of the compiler, I do not see this issue.
I will see if I can port it forward to see if I still see the problem
but it might be difficult to port from 4.3.2 to 4.4.2, I'm not sure
how many things have changed but I'm sure quite a bit !
This is the -v of my GCC, version 4.3.3:
Using built-in specs.
Target: myarch64-linux-elf
Configured with:
/home/beyler/myarch64/src/myarch64-gcc-4.3.2/configure
--target=myarch64-linux-elf
--with-headers=/home/beyler/myarch64/src/newlib-1.16.0/newlib/libc/include
--prefix=/home/beyler/myarch64/local --disable-nls
--enable-languages=c --with-newlib --disable-libssp
--with-mpfr=/home/beyler/myarch64/local
Thread model: single
gcc version 4.3.3 (GCC)
Jc
PS: I have already asked the gmp bug mailing list to see if they have
any input on this.
On Thu, Dec 17, 2009 at 6:19 AM, Jay Foad <jay.foad@gmail.com> wrote:
> If it's the bug being discussed here:
>
> http://gmplib.org/list-archives/gmp-discuss/2009-April/003717.html
>
> ... then it was reported as fixed here:
>
> http://gcc.gnu.org/ml/gcc/2009-04/msg00562.html
>
> Jay.
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-17 22:27 ` Jean Christophe Beyler
@ 2009-12-18 2:29 ` Jie Zhang
2009-12-18 14:46 ` Jean Christophe Beyler
0 siblings, 1 reply; 9+ messages in thread
From: Jie Zhang @ 2009-12-18 2:29 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: Jay Foad, Steven Bosscher, Richard Guenther, gcc
On 12/18/2009 06:27 AM, Jean Christophe Beyler wrote:
> Actually, I just finished updating my 4.3.2 to 4.3.3 and tested it and
> I still have the same issue.
>
> This seems to be a problem more than "just" 4.3.2.
>
> Here is the test program:
> #include<stdio.h>
> #include<gmp.h>
>
> int main() {
> mpz_t a,b;
> mpz_init_set_str(a, "10000000000", 10); // program works with 10^9, but not
> // with 10^10 (10^20> 2^64)
> mpz_init_set(b, a);
> mpz_mul(a, a, a);
> gmp_printf("first, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b, a);
> mpz_set(b, a);
> mpz_mul(a, a, a);
> gmp_printf("second, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b, a);
> return 0;
> }
>
> We obtain:
> first, in GMP mpz_mul(a,a,a) with a=10000000000 gives 100000000000000000000
> second, in GMP mpz_mul(a,a,a) with a=100000000000000000000 gives
> 22545360131605409929222215637663717291581095979492475463214517286840718852096
>
> Which clearly is wrong for the second output.
>
> This was tested with a 64 bit architecture. I know that with a 4.1.1
> port of the compiler, I do not see this issue.
>
> I will see if I can port it forward to see if I still see the problem
> but it might be difficult to port from 4.3.2 to 4.4.2, I'm not sure
> how many things have changed but I'm sure quite a bit !
>
> This is the -v of my GCC, version 4.3.3:
> Using built-in specs.
> Target: myarch64-linux-elf
> Configured with:
> /home/beyler/myarch64/src/myarch64-gcc-4.3.2/configure
> --target=myarch64-linux-elf
> --with-headers=/home/beyler/myarch64/src/newlib-1.16.0/newlib/libc/include
> --prefix=/home/beyler/myarch64/local --disable-nls
> --enable-languages=c --with-newlib --disable-libssp
> --with-mpfr=/home/beyler/myarch64/local
> Thread model: single
> gcc version 4.3.3 (GCC)
>
What's myarch64? I got the correct result for your test with vanilla
gcc-4.3.2 and gmp-4.3.1 on Debian unstable AMD64.
Jie
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-18 2:29 ` Jie Zhang
@ 2009-12-18 14:46 ` Jean Christophe Beyler
0 siblings, 0 replies; 9+ messages in thread
From: Jean Christophe Beyler @ 2009-12-18 14:46 UTC (permalink / raw)
To: Jie Zhang; +Cc: Jay Foad, Steven Bosscher, Richard Guenther, gcc
myarch64 is my port.
Then perhaps this is an back-end problem on my port. I'll try to
determine this today and keep you posted.
Jc
On Thu, Dec 17, 2009 at 9:29 PM, Jie Zhang <jie.zhang@analog.com> wrote:
> On 12/18/2009 06:27 AM, Jean Christophe Beyler wrote:
>>
>> Actually, I just finished updating my 4.3.2 to 4.3.3 and tested it and
>> I still have the same issue.
>>
>> This seems to be a problem more than "just" 4.3.2.
>>
>> Here is the test program:
>> #include<stdio.h>
>> #include<gmp.h>
>>
>> int main() {
>> mpz_t a,b;
>> mpz_init_set_str(a, "10000000000", 10); // program works with 10^9,
>> but not
>> // with 10^10 (10^20> 2^64)
>> mpz_init_set(b, a);
>> mpz_mul(a, a, a);
>> gmp_printf("first, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b,
>> a);
>> mpz_set(b, a);
>> mpz_mul(a, a, a);
>> gmp_printf("second, in GMP mpz_mul(a,a,a) with a=%Zd gives %Zd \n", b,
>> a);
>> return 0;
>> }
>>
>> We obtain:
>> first, in GMP mpz_mul(a,a,a) with a=10000000000 gives
>> 100000000000000000000
>> second, in GMP mpz_mul(a,a,a) with a=100000000000000000000 gives
>>
>> 22545360131605409929222215637663717291581095979492475463214517286840718852096
>>
>> Which clearly is wrong for the second output.
>>
>> This was tested with a 64 bit architecture. I know that with a 4.1.1
>> port of the compiler, I do not see this issue.
>>
>> I will see if I can port it forward to see if I still see the problem
>> but it might be difficult to port from 4.3.2 to 4.4.2, I'm not sure
>> how many things have changed but I'm sure quite a bit !
>>
>> This is the -v of my GCC, version 4.3.3:
>> Using built-in specs.
>> Target: myarch64-linux-elf
>> Configured with:
>> /home/beyler/myarch64/src/myarch64-gcc-4.3.2/configure
>> --target=myarch64-linux-elf
>> --with-headers=/home/beyler/myarch64/src/newlib-1.16.0/newlib/libc/include
>> --prefix=/home/beyler/myarch64/local --disable-nls
>> --enable-languages=c --with-newlib --disable-libssp
>> --with-mpfr=/home/beyler/myarch64/local
>> Thread model: single
>> gcc version 4.3.3 (GCC)
>>
> What's myarch64? I got the correct result for your test with vanilla
> gcc-4.3.2 and gmp-4.3.1 on Debian unstable AMD64.
>
>
> Jie
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-16 18:50 Jean Christophe Beyler
2009-12-16 19:37 ` Richard Guenther
@ 2009-12-17 10:27 ` Andrew Haley
1 sibling, 0 replies; 9+ messages in thread
From: Andrew Haley @ 2009-12-17 10:27 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: gcc
Jean Christophe Beyler wrote:
> Dear all,
>
> Found on http://gmplib.org/.
>
> "N.B. gcc 4.3.2 miscompiles GMP 4.3.x on 64-bit machines. The problem
> is specific to that very release; specifically gcc 4.3.1 and 4.3.3
> seem to work fine."
>
> Since porting to a newer version is difficult for me right now, I was
> wondering if anybody worked on a patch for this specific problem.
There's no porting to be done: gcc 4.3.3 is just a bunch of bug fixes.
Andrew.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-16 20:54 ` Jean Christophe Beyler
@ 2009-12-16 21:59 ` Steven Bosscher
0 siblings, 0 replies; 9+ messages in thread
From: Steven Bosscher @ 2009-12-16 21:59 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: Richard Guenther, gcc
On Wed, Dec 16, 2009 at 9:54 PM, Jean Christophe Beyler
<jean.christophe.beyler@gmail.com> wrote:
> I've actually searched but still can't find any mention of such bugs/patches.
>
> If anybody remembers a key word I could use, that would help. I've
> tried "4.3.2" or "GMP" but haven't found anything.
I have tried a search on bugs with "Known to fail: 4.3.2" and "Known
to work: 4.3.1 and 4.3.2". This gives no result either, so if
something was fixed then the target milestones aren't set correctly.
A Google search directs me to
http://www.mail-archive.com/debian-gcc@lists.debian.org/msg32172.html
and from there to http://gcc.gnu.org/PR36765. But that doesn't look
like the right bug.
A search on all bugs (open and closed) in GCC bugzilla also gives no
useful results.
It looks like this was never even filed in GCC bugzilla...?
Ciao!
Steven
> Thanks a lot,
> Jc
>
> On Wed, Dec 16, 2009 at 2:37 PM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Wed, Dec 16, 2009 at 7:50 PM, Jean Christophe Beyler
>> <jean.christophe.beyler@gmail.com> wrote:
>>> Dear all,
>>>
>>> Found on http://gmplib.org/.
>>>
>>> "N.B. gcc 4.3.2 miscompiles GMP 4.3.x on 64-bit machines. The problem
>>> is specific to that very release; specifically gcc 4.3.1 and 4.3.3
>>> seem to work fine."
>>>
>>> Since porting to a newer version is difficult for me right now, I was
>>> wondering if anybody worked on a patch for this specific problem.
>>
>> It has been fixed for 4.3.3. You can search bugzilla to find the
>> offending patch.
>>
>> Richard.
>>
>>> Thanks,
>>> Jc
>>>
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-16 19:37 ` Richard Guenther
@ 2009-12-16 20:54 ` Jean Christophe Beyler
2009-12-16 21:59 ` Steven Bosscher
0 siblings, 1 reply; 9+ messages in thread
From: Jean Christophe Beyler @ 2009-12-16 20:54 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc
I've actually searched but still can't find any mention of such bugs/patches.
If anybody remembers a key word I could use, that would help. I've
tried "4.3.2" or "GMP" but haven't found anything.
Thanks a lot,
Jc
On Wed, Dec 16, 2009 at 2:37 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Dec 16, 2009 at 7:50 PM, Jean Christophe Beyler
> <jean.christophe.beyler@gmail.com> wrote:
>> Dear all,
>>
>> Found on http://gmplib.org/.
>>
>> "N.B. gcc 4.3.2 miscompiles GMP 4.3.x on 64-bit machines. The problem
>> is specific to that very release; specifically gcc 4.3.1 and 4.3.3
>> seem to work fine."
>>
>> Since porting to a newer version is difficult for me right now, I was
>> wondering if anybody worked on a patch for this specific problem.
>
> It has been fixed for 4.3.3. You can search bugzilla to find the
> offending patch.
>
> Richard.
>
>> Thanks,
>> Jc
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GMP and GCC 4.3.2
2009-12-16 18:50 Jean Christophe Beyler
@ 2009-12-16 19:37 ` Richard Guenther
2009-12-16 20:54 ` Jean Christophe Beyler
2009-12-17 10:27 ` Andrew Haley
1 sibling, 1 reply; 9+ messages in thread
From: Richard Guenther @ 2009-12-16 19:37 UTC (permalink / raw)
To: Jean Christophe Beyler; +Cc: gcc
On Wed, Dec 16, 2009 at 7:50 PM, Jean Christophe Beyler
<jean.christophe.beyler@gmail.com> wrote:
> Dear all,
>
> Found on http://gmplib.org/.
>
> "N.B. gcc 4.3.2 miscompiles GMP 4.3.x on 64-bit machines. The problem
> is specific to that very release; specifically gcc 4.3.1 and 4.3.3
> seem to work fine."
>
> Since porting to a newer version is difficult for me right now, I was
> wondering if anybody worked on a patch for this specific problem.
It has been fixed for 4.3.3. You can search bugzilla to find the
offending patch.
Richard.
> Thanks,
> Jc
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* GMP and GCC 4.3.2
@ 2009-12-16 18:50 Jean Christophe Beyler
2009-12-16 19:37 ` Richard Guenther
2009-12-17 10:27 ` Andrew Haley
0 siblings, 2 replies; 9+ messages in thread
From: Jean Christophe Beyler @ 2009-12-16 18:50 UTC (permalink / raw)
To: gcc
Dear all,
Found on http://gmplib.org/.
"N.B. gcc 4.3.2 miscompiles GMP 4.3.x on 64-bit machines. The problem
is specific to that very release; specifically gcc 4.3.1 and 4.3.3
seem to work fine."
Since porting to a newer version is difficult for me right now, I was
wondering if anybody worked on a patch for this specific problem.
Thanks,
Jc
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-12-18 14:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-17 11:19 GMP and GCC 4.3.2 Jay Foad
2009-12-17 22:27 ` Jean Christophe Beyler
2009-12-18 2:29 ` Jie Zhang
2009-12-18 14:46 ` Jean Christophe Beyler
-- strict thread matches above, loose matches on Subject: below --
2009-12-16 18:50 Jean Christophe Beyler
2009-12-16 19:37 ` Richard Guenther
2009-12-16 20:54 ` Jean Christophe Beyler
2009-12-16 21:59 ` Steven Bosscher
2009-12-17 10:27 ` Andrew Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).