This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix execute/20020406-1.c
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Apr 2002 16:57:38 -0700
- Subject: fix execute/20020406-1.c
The test case was buggy once you got past the
recursive call problem it was trying to show.
r~
* gcc.c-torture/execute/20020406-1.c (DUPFFnew): Use calloc.
Index: gcc.c-torture/execute/20020406-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/20020406-1.c,v
retrieving revision 1.1.2.2
diff -c -p -d -r1.1.2.2 20020406-1.c
*** gcc.c-torture/execute/20020406-1.c 10 Apr 2002 17:46:49 -0000 1.1.2.2
--- gcc.c-torture/execute/20020406-1.c 12 Apr 2002 23:52:51 -0000
***************
*** 2,7 ****
--- 2,8 ----
// PR c/5120
extern void * malloc (__SIZE_TYPE__);
+ extern void * calloc (__SIZE_TYPE__, __SIZE_TYPE__);
typedef unsigned int FFelem;
*************** DUPFF DUPFFnew(const int maxdeg)
*** 31,37 ****
{
DUPFF ans = (DUPFF)malloc(sizeof(struct DUPFFstruct));
ans->coeffs = 0;
! if (maxdeg >= 0) ans->coeffs = (FFelem*)malloc((maxdeg+1)*sizeof(FFelem));
ans->maxdeg = maxdeg;
ans->deg = -1;
return ans;
--- 32,38 ----
{
DUPFF ans = (DUPFF)malloc(sizeof(struct DUPFFstruct));
ans->coeffs = 0;
! if (maxdeg >= 0) ans->coeffs = (FFelem*)calloc(maxdeg+1,sizeof(FFelem));
ans->maxdeg = maxdeg;
ans->deg = -1;
return ans;