* gcc.c-torture/execute/20020406-1.c (DUPFFnew): Use calloc.

From-SVN: r52254
This commit is contained in:
Richard Henderson 2002-04-12 16:54:03 -07:00 committed by Richard Henderson
parent 01e93ba048
commit 36ea005204
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2002-04-12 Richard Henderson <rth@redhat.com>
* gcc.c-torture/execute/20020406-1.c (DUPFFnew): Use calloc.
2002-04-12 Richard Sandiford <rsandifo@redhat.com>
* g++.dg/ext/attrib5.C,

View File

@ -2,6 +2,7 @@
// PR c/5120
extern void * malloc (__SIZE_TYPE__);
extern void * calloc (__SIZE_TYPE__, __SIZE_TYPE__);
typedef unsigned int FFelem;
@ -31,7 +32,7 @@ DUPFF DUPFFnew(const int maxdeg)
{
DUPFF ans = (DUPFF)malloc(sizeof(struct DUPFFstruct));
ans->coeffs = 0;
if (maxdeg >= 0) ans->coeffs = (FFelem*)malloc((maxdeg+1)*sizeof(FFelem));
if (maxdeg >= 0) ans->coeffs = (FFelem*)calloc(maxdeg+1,sizeof(FFelem));
ans->maxdeg = maxdeg;
ans->deg = -1;
return ans;