re PR c++/9373 (ICE with -fstrict-aliasing in set_mem_alias_set, at emit-rtl.c:1932)
authorMark Mitchell <mark@codesourcery.com>
Mon, 10 Mar 2003 07:26:34 +0000 (07:26 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 10 Mar 2003 07:26:34 +0000 (07:26 +0000)
PR c++/9373
* g++.dg/opt/ptrmem2.C: New test.

PR c++/9373
* cp-lang.c (cxx_get_alias_set): Use alias set zero for
pointers to member functions.

From-SVN: r64070

gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/ptrmem2.C [new file with mode: 0644]

index 257673fd205b1f58de401cf1df0cf86fd97fdf6b..72dcb9dc3a6305422ea44f64eb59a05e4f5d5c70 100644 (file)
@@ -1,5 +1,9 @@
 2003-03-09  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9373
+       * cp-lang.c (cxx_get_alias_set): Use alias set zero for
+       pointers to member functions.
+
        PR c++/8534
        * decl.c (build_ptrmemfunc_type): Do not allow default arugments
        in pointer-to-member-function types.
index 3671027ebe6b4737b75b99ca15189a595afabf0f..b35c31c0763452e6a455704eaafcab7205dfd547 100644 (file)
@@ -262,8 +262,14 @@ ok_to_generate_alias_set_for_type (tree t)
 static HOST_WIDE_INT
 cxx_get_alias_set (tree t)
 {
-  /* It's not yet safe to use alias sets for classes in C++.  */
-  if (!ok_to_generate_alias_set_for_type(t))
+  
+  if (/* It's not yet safe to use alias sets for some classes in C++.  */
+      !ok_to_generate_alias_set_for_type (t)
+      /* Nor is it safe to use alias sets for pointers-to-member
+        functions, due to the fact that there may be more than one
+        RECORD_TYPE type corresponding to the same pointer-to-member
+        type.  */
+      || TYPE_PTRMEMFUNC_P (t))
     return 0;
 
   return c_common_get_alias_set (t);
index 517f3b4193c54bc83fe0fcabf874009f0c1b81a9..976ce7d5d37df7b215eff327b2dd0de0c640f0a5 100644 (file)
@@ -1,5 +1,8 @@
 2003-03-09  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9373
+       * g++.dg/opt/ptrmem2.C: New test.
+
        PR c++/8534
        * g++.dg/opt/ptrmem1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/opt/ptrmem2.C b/gcc/testsuite/g++.dg/opt/ptrmem2.C
new file mode 100644 (file)
index 0000000..19c43f7
--- /dev/null
@@ -0,0 +1,12 @@
+typedef unsigned int Mword;
+struct Thread
+{
+  Mword sys_ipc_log();
+  void hook_ipc_vector();
+  unsigned (Thread::*syscall_table)();
+};
+
+void Thread::hook_ipc_vector()
+{
+  syscall_table = &Thread::sys_ipc_log;
+}