This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] dfp.c fix for decimal float constants with LP64 host
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: janis187 at us dot ibm dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 7 May 2009 06:15:37 -0700
- Subject: Re: [PATCH] dfp.c fix for decimal float constants with LP64 host
- References: <1241546532.5947.1.camel@janis-laptop>
On Tue, May 5, 2009 at 11:02 AM, Janis Johnson <janis187@us.ibm.com> wrote:
> Conversions within the compiler of decimal float values to integers,
> and vice versa, were done via a memcpy of 32 bits from chunks of the
> decimal float value to elements of an array of type long. ?This worked
> fine when the host was ILP32 but not when the host was LP64, leading
> to invalid constants in the assembly code. ?For powerpc64-linux the
> constants were rejected by the assembler, so the effective-target test
> for being able to run decimal float tests failed, making the tests in
> gcc.dg/dfp compile-only and skipping the use of decimal float types in
> the struct-layout-1 compatiblity tests. ?On x86_64-linux positive
> constants were OK, negative constants were incorrect.
>
> This patch fixes the problem by using a memcpy into a 32-bit int and
> then assigning that value (with sign-extension) into the long array
> element.
>
> Bootstrap and regression tested on powerpc64-linux, -m32 and -m64,
> with compilers built as both 32-bit and 64-bit binaries, all
> languages but Ada. ?Bootstrapped C on i686-linux and x86_64-linux,
> with --enable-decimal-float=bid and --enable-decimal-float=dpd,
> and ran the gcc.dg/dfp tests, with no test regressions anywhere.
> OK for trunk and open release branches?
>
> 2009-05-05 ?Janis Johnson ?<janis187@us.ibm.com>
>
> gcc/
> ? ? ? ?PR middle-end/39986
> ? ? ? ?* dfp.c (encode_decimal32, decode_decimal32, encode_decimal64,
> ? ? ? ?decode_decimal64, encode_decimal128, decode_decimal128): Avoid
> ? ? ? ?32-bit memcpy into long.
>
> gcc/testsuite/
> ? ? ? ?PR middle-end/39986
> ? ? ? ?* gcc.dg/dfp/pr39986.c: New test.
Hi Janis,
You only checked the testcase into 4.4 branch:
http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00163.html
You missed the dfp.c change.
Thanks.
--
H.J.