TYPE_PTRMEMFUNC_P
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Tue May 25 14:44:00 GMT 2004
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
More information about the Gcc
mailing list