This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 9373
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 9 Mar 2003 23:30:48 -0800
- Subject: C++ PATCH: PR 9373
- Reply-to: mark at codesourcery dot com
Here's another pointer-to-member vs. alias set fix; the
record_component_aliases stuff gets rather badly confused, so it's
best just to diable it.
Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com
2003-03-09 Mark Mitchell <mark at codesourcery dot com>
PR c++/9373
* cp-lang.c (cxx_get_alias_set): Use alias set zero for
pointers to member functions.
2003-03-09 Mark Mitchell <mark at codesourcery dot com>
PR c++/9373
* g++.dg/opt/ptrmem2.C: New test.
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.47
diff -c -5 -p -r1.47 cp-lang.c
*** cp/cp-lang.c 18 Feb 2003 18:50:05 -0000 1.47
--- cp/cp-lang.c 10 Mar 2003 07:17:25 -0000
*************** ok_to_generate_alias_set_for_type (tree
*** 260,271 ****
/* Special routine to get the alias set for C++. */
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))
return 0;
return c_common_get_alias_set (t);
}
--- 260,277 ----
/* Special routine to get the alias set for C++. */
static HOST_WIDE_INT
cxx_get_alias_set (tree 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: testsuite/g++.dg/opt/ptrmem2.C
===================================================================
RCS file: testsuite/g++.dg/opt/ptrmem2.C
diff -N testsuite/g++.dg/opt/ptrmem2.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/opt/ptrmem2.C 10 Mar 2003 07:17:30 -0000
***************
*** 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;
+ }