From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29130 invoked by alias); 18 Dec 2009 14:46:34 -0000 Received: (qmail 29119 invoked by uid 22791); 18 Dec 2009 14:46:33 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f203.google.com (HELO mail-pz0-f203.google.com) (209.85.222.203) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Dec 2009 14:46:26 +0000 Received: by pzk41 with SMTP id 41so2059424pzk.0 for ; Fri, 18 Dec 2009 06:46:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.141.23.17 with SMTP id a17mr2782316rvj.17.1261147584510; Fri, 18 Dec 2009 06:46:24 -0800 (PST) In-Reply-To: <4B2AE8FE.3080304@analog.com> References: <4B2AE8FE.3080304@analog.com> Date: Fri, 18 Dec 2009 14:46:00 -0000 Message-ID: Subject: Re: GMP and GCC 4.3.2 From: Jean Christophe Beyler To: Jie Zhang Cc: Jay Foad , Steven Bosscher , Richard Guenther , gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00281.txt.bz2 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 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 >> #include >> >> int main() { >> =A0 =A0 mpz_t a,b; >> =A0 =A0 mpz_init_set_str(a, "10000000000", 10); // program works with 10= ^9, >> but not >> =A0 =A0 // with 10^10 (10^20> =A02^64) >> =A0 =A0 mpz_init_set(b, a); >> =A0 =A0 mpz_mul(a, a, a); >> =A0 =A0 gmp_printf("first, =A0in GMP mpz_mul(a,a,a) with a=3D%Zd gives %= Zd \n", b, >> a); >> =A0 =A0 mpz_set(b, a); >> =A0 =A0 mpz_mul(a, a, a); >> =A0 =A0 gmp_printf("second, in GMP mpz_mul(a,a,a) with a=3D%Zd gives %Zd= \n", b, >> a); >> =A0 =A0 return 0; >> } >> >> We obtain: >> first, =A0in GMP mpz_mul(a,a,a) with a=3D10000000000 gives >> 100000000000000000000 >> second, in GMP mpz_mul(a,a,a) with a=3D100000000000000000000 gives >> >> 225453601316054099292222156376637172915810959794924754632145172868407188= 52096 >> >> 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=3Dmyarch64-linux-elf >> --with-headers=3D/home/beyler/myarch64/src/newlib-1.16.0/newlib/libc/inc= lude >> --prefix=3D/home/beyler/myarch64/local --disable-nls >> --enable-languages=3Dc --with-newlib --disable-libssp >> --with-mpfr=3D/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 >