This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix oversight in bitfield_overlaps_p
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Eric Botcazou" <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 31 Oct 2008 12:50:44 +0100
- Subject: Re: [PATCH] Fix oversight in bitfield_overlaps_p
- References: <200810311227.52203.ebotcazou@adacore.com>
On Fri, Oct 31, 2008 at 12:27 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the x86-64 compiler generates wrong code on the 4.3 branch for the attached
> testcase because the constant folder turns the test
>
> if Var.Length = 1
> and then Var.Content (1) = Bla
>
> into a BIT_FIELD_REF and then SRA wrongly computes that in
>
> M.Length := 1;
> M.Content := (others => Bla);
>
> the initialization of M.Content doesn't matter. bitfield_overlaps_p simply
> considers that all arrays are zero-based, which is not often true in Ada.
>
> Tested on x86_64-suse-linux, OK for mainline and 4.3 branch?
Does this work with variable bases, that is if the minimum value is gimplified?
I think we should use array_ref_low_bound properly, which of course requires
access to the original array-ref here. Or does SRA punt for ARRAY_REFs
with variable lower bound? The patch is ok in this case or with a change to
make SRA punt in this case.
Thanks,
Richard.
>
> 2008-10-31 Eric Botcazou <ebotcazou@adacore.com>
>
> * tree-sra.c (bitfield_overlaps_p): Fix oversight.
>
>
> 2008-10-31 Eric Botcazou <ebotcazou@adacore.com>
>
> * gnat.dg/array5.adb New test.
>
>
> --
> Eric Botcazou
>