RFC: [PATCH]: PR31806 - Fix MEM_READONLY_P aliasing disambiguation

Andrew Pinski pinskia@gmail.com
Wed May 30 16:37:00 GMT 2007


On 5/30/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> >
> > Any comments?
>
> I think those mems should not be MEM_READONLY_P if they are written to
> (if not the program is invalid).  Of course the patch is a reasonable
> workaround for
> the branches if the "real" fix is too invasive.  I suppose the
> frontend(s) set this
> bit?

I mentioned the same thing in the bug report and pointed to another
bug report where the front-end messes up TREE_READONLY (PR 31809).
MEM_READONLY_P is set from TREE_READONLY:
      if (base && DECL_P (base)
          && TREE_READONLY (base)
          && (TREE_STATIC (base) || DECL_EXTERNAL (base)))
        {
          tree base_type = TREE_TYPE (base);
          gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type))
                      || DECL_ARTIFICIAL (base));
          MEM_READONLY_P (ref) = 1;
        }


So the real issue is the C++ front-end is setting TREE_READONLY to
true when it should not (exactly the same as PR 31809).

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list