This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]