This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
TYPE_PTRMEMFUNC_P
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 25 May 2004 16:36:33 +0200
- Subject: TYPE_PTRMEMFUNC_P
Hello,
I am toying with lowering address arithmetics in late phases of tree-ssa
on lno-branch, and I have encountered the following problem:
I have this testcase:
struct A { };
int func(A *oa, int (A::*pmf)(int))
{ return (oa->*pmf)(2); }
Which translates to (irrelevant parts stripped):
int func(A*, int (A::*)(int)) (oa, pmf)
{
A:: * pmf$__pfn;
pmf$__pfn_25 = pmf.__pfn;
...
}
Address arithmetics lowering alters this to:
A:: * pmf$__pfn;
A:: * * ruatmp.18;
A:: * * fgotmp.17;
fgotmp.17_30 = (A:: * *)&pmf;
ruatmp.18_31 = fgotmp.17_30;
pmf$__pfn_25 = *ruatmp.18_31;
Which is later (wrongly) simplified to
pmf$__pfn_25 = pmf;
Which later crashes, since type of pmf is
struct
{
A:: * __pfn;
long int __delta;
}
The problem seems to be that cp/typeck.c:comptypes considers
A:: * (whatever this type means) and the above type equivalent,
since TYPE_PTRMEMFUNC_P is true for the above type and it therefore
compares TYPE_PTRMEMFUNC_FN_TYPE of it instead, which happens to be
A:: *.
Since I do not quite understand what TYPE_PTRMEMFUNC_P and related
stuff means, I don't know where to fix the problem. Could someone help,
please?
Zdenek