This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix for PR31617
- From: Olga Golovanevsky <OLGA at il dot ibm dot com>
- To: "Richard Guenther" <richard dot guenther at gmail dot com>, "Andrew Pinski" <pinskia at gmail dot com>
- Cc: "Daniel Berlin" <dberlin at dberlin dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "Jan Hubicka" <jh at suse dot cz>, "Martin Michlmayr" <tbm at cyrius dot com>, "Kenneth Zadeck" <zadeck at naturalbridge dot com>
- Date: Mon, 23 Apr 2007 13:21:07 +0300
- Subject: Re: [patch] Fix for PR31617
"Richard Guenther" <richard.guenther@gmail.com> wrote on 21/04/2007
12:21:36:
>
> I think it's better to check for bottom being zero in the predicate
before,
> like
>
> case INTEGER_CST:
> if (TREE_CODE (bottom) != INTEGER_CST
> + || integer_zerop (bottom)
> || (TYPE_UNSIGNED (type)
> && (tree_int_cst_sgn (top) < 0
> || tree_int_cst_sgn (bottom) < 0)))
> return 0;
> return integer_zerop (int_const_binop (TRUNC_MOD_EXPR,
> top, bottom, 0));
>
> because this is the only case integer_zerop may return NULL.
ok, it also works in this case.
>
> Richard.
>
I reduced - as much as I can to reproduce segfault -
the testcase provided by Martin.
Where should I put it in testsuite?
Olga
#define N 1000
template<class T> class array
{
int n;
T *a;
public: inline array (const array<T>&);
public: inline array (int n=0);
inline T& operator [] (int i) {}
};
template<class T> array<T>::array (int n2):
n(n2), a((n==0)?((T*) __null):(new T[n * sizeof (T)])) {}
template<typename T> class vector
{
public: inline vector (const vector<T>&);
inline vector () { T* a= new T[0]; }
};
template<typename T> class polynomial
{
public: inline polynomial (const polynomial<T>&);
inline ~polynomial ();
inline polynomial () {}
};
template<typename T> vector<polynomial<T> >
operator * (int c, polynomial<T> p) {}
typedef polynomial<double> dpol;
typedef vector<polynomial<double> > dpols;
struct spline_rep
{
int n;
array<dpols> p;
spline_rep ();
};
spline_rep::spline_rep (): n(N-1)
{
array<dpol> p1;
int i;
p[i]= 5*p1[i];
}