This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
lno-branch vs ptr-to-member
- From: Dale Johannesen <dalej at apple dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>, Sebastian Pop <sebastian dot pop at cri dot ensmp dot fr>, gcc_mailing_list List <gcc at gcc dot gnu dot org>
- Cc: Dale Johannesen <dalej at apple dot com>
- Date: Tue, 8 Jun 2004 12:28:18 -0700
- Subject: lno-branch vs ptr-to-member
I'm having a problem demonstrated by the example below. The key
difficulty is
h = h + rowData[r].*size;
which is gimplified into
size.6<D1654>_15 = (int<D2>)size<D1640>_14;
T.7<D1655>_16 = T.5<D1653>_13 + size.6<D1654>_15;
The code that looks for induction variables tries to analyze
(int<D2>)size<D1640>_14
and winds up trying to do the conversion at compile time through
this chain of calls:
interpret_rhs_modify_expr
chrec_convert
convert
ocp_convert
convert_to_integer
which crashes with
3683113.sm.cc:25: error: aggregate value used where an integer was
expected
I'm not familiar enough with ptr-to-member to figure out what it ought
to be doing,
but this isn't it. Please help. (It seems wrong to call those
particular conversion
routines here at all, since they call 'error' for problems, which looks
like user errors
not compiler internal errors.)
I'll file a PR on this shortly.
class QGArray
{
public:
char *at (unsigned int index) const { return &shd[index]; }
char *shd;
};
template<class type>
class QMemArray : public QGArray
{
public:
type& operator[]( int i ) const
{ return (type &)(*(type *)QGArray::at(i*sizeof(type))); }
};
struct QLayoutStruct
{
bool empty;
};
class QGridLayoutData
{
int rr;
int findSize (int QLayoutStruct::*) const;
QMemArray<QLayoutStruct> rowData;
};
int QGridLayoutData::findSize( int QLayoutStruct::*size ) const
{
int h = 0;
int n = 0;
for ( int r = 0; r < rr; r++ ) {
h = h + rowData[r].*size;
if ( !rowData[r].empty )
n++;
}
return n * h;
}