https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91606

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
So I think we can recover what the C++ FE tries to do (assign alias-set zero
to the whole PMF struct) by really treating it as a fat pointer.  That
restores using alias-set zero for the _31->__pfn accesses and fixes the
testcase.

Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c       (revision 276396)
+++ gcc/cp/decl.c       (working copy)
@@ -9554,10 +9554,12 @@ build_ptrmemfunc_type (tree type)
   TYPE_PTRMEMFUNC_FLAG (t) = 1;

   field = build_decl (input_location, FIELD_DECL, pfn_identifier, type);
+  DECL_NONADDRESSABLE_P (field) = 1;
   fields = field;

   field = build_decl (input_location, FIELD_DECL, delta_identifier, 
                      delta_type_node);
+  DECL_NONADDRESSABLE_P (field) = 1;
   DECL_CHAIN (field) = fields;
   fields = field;

this tells the middle-end that there are no accesses to those fields
via pointers to the field but they always appear via pointers to
the containing record (or containing records).  I think that's true
for what the C++ FE emits and for what a user can do with a PMF.

Otherwise I fear what the C++ FE does in it's get_alias_set langhook
doesn't work by design :/

I will test the above.

Reply via email to