This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32882] Mismatched types with pointer to member functions and -fstrict-aliasing



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-07-25 13:48 -------
With -fstrict-aliasing we claim the conversion is neccessary because the
pointed
to alias sets of the two pointers are different.  For -fno-strict-aliasing the
frontend later says via the langhook that the two structures are compatible.

Now, both pointer-to-member function structures get assigned alias set zero
anyway from cxx_get_alias_set, but pointers to such structures get their
own alias set.

Index: cp-objcp-common.c
===================================================================
--- cp-objcp-common.c   (revision 126911)
+++ cp-objcp-common.c   (working copy)
@@ -45,7 +45,9 @@ cxx_get_alias_set (tree t)
     return get_alias_set (TYPE_CONTEXT (t));

   /* Punt on PMFs until we canonicalize functions properly.  */
-  if (TYPE_PTRMEMFUNC_P (t))
+  if (TYPE_PTRMEMFUNC_P (t)
+      || (POINTER_TYPE_P (t)
+         && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
     return 0;

   return c_common_get_alias_set (t);

get's this case "working".  Of course it may be time to "canonicalize
functions properly".


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]