[PATCH, PR 40493] Fix SRA miscompilation of binutils

H.J. Lu hjl.tools@gmail.com
Fri Jun 26 03:35:00 GMT 2009


2009/6/24 Martin Jambor <mjambor@suse.cz>:
> Hi,
>
> the patch below fixes two rather serious problems in the new SRA.
>
> The  first one  is  that I  misremembered  the order  of arguments  of
> BIT_FIELD_REF and was looking for the offset and size of the reference
> at exactly the wrong places.
>
> The second  is a slightly  more complex one.   sra_modify_assign() and
> load_assign_lhs_subreplacements()  try hard  to  remove the  aggregate
> assignment  if  possible  and  so  can  decide  to  flush  RHS  scalar
> replacements  directly to  the  LHS  when it  knows  there's no  other
> (unscalarized) data on the RHS.  That is all good and well except that
> load_assign_lhs_subreplacements() always  looked to the  RHS aggregate
> when it did  not find a RHS scalar replacement  corresponding to a LHS
> scalar replacement.  However, that contained
>
> This patch fixes  this changes a boolean variable  that keeps track of
> whether scalars were flushed into one of the original aggregates to an
> enum that also tells to which one and makes
> load_assign_lhs_subreplacements use it to look at the correct place.
>
> I have bootstrapped  and tested this on x86-64.   There was however an
> acats new  failure which has something  to do with  timing and delays.
> However, these happen  to me all the  time but go away when  I run the
> tests again and so that's what I am doing right now.
>
> So, is this OK provided that the acats failure does not reoccur?
>
> Thanks,
>
> Martin
>
> 2009-06-24  Martin Jambor  <mjambor@suse.cz>
>
>        * tree-sra.c (sra_modify_expr): Correct BIT_FIELD_REF argument numbers.
>        (enum unscalarized_data_handling): New type.
>        (handle_unscalarized_data_in_subtree): Return what has been done.
>        (load_assign_lhs_subreplacements): Handle left flushes differently.
>        (sra_modify_assign): Use unscalarized_data_handling, simplified
>        condition determining whether to remove the statement.
>
>        * testsuite/gcc.c-torture/execute/pr40493.c: New test.
>

This patch caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40554


H.J.



More information about the Gcc-patches mailing list