[PING] tighten gimple addressability checks

Richard Guenther richard.guenther@gmail.com
Fri Dec 7 17:59:00 GMT 2007

On Dec 7, 2007 6:01 PM, Olivier Hainque <hainque@adacore.com> wrote:
> Hello,
>    http://gcc.gnu.org/ml/gcc-patches/2007-10/msg01504.html
> Olivier Hainque wrote:
> > is_gimple_addressable is fairly permissive today, and I think too
> > permissive in some cases.
> >
> > In particular, COMPONENT_REFs are all considered addressable while
> > the address of BIT_FIELD decls sometimes really can't be taken.
> [...]
>  This is a suggestion to fix regressions (compiler crash on valid
>  code) compared to the 3.4 series. As I wrote then:
> > I realize this is invasive and would be happy to discuss enhancements
> > or alternate ways out as necessary.

"2) Some DECL_BIT_FIELD components can actually have their address taken
   and rejecting all of those would lead to severe pessimization, typically
   from useless creation of temporaries, if not compiler crashes when
   variable sizes are at sake."

Can you elaborate on this somewhat?  I believe that for

is_gimple_addressable (tree t)
  return (is_gimple_id (t) || handled_component_p (t)
          || INDIRECT_REF_P (t));

there is indeed the defect that this allows BIT_FIELD_REF.  I don't think
that the middle-end expects a sub-reference of a non-aligned unit (that
is, your claim that we would need to recurse sounds like another Ada
speciality - *sigh*).

But without some elaboration on why we cannot just fix is_gimple_addressable
I would go with such a patch instead.



More information about the Gcc-patches mailing list