This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
expected calloc out put
- From: Sharyathi Nagesh <sharyath at in dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: sharyath at in dot ibm dot com
- Date: Wed, 25 Oct 2006 16:17:49 +0530
- Subject: expected calloc out put
- Reply-to: sharyath at in dot ibm dot com
Hi
ltp test suite tests for 2 successive calloc()s like this
=====================
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#define MAX 8092*8092
int main()
{
char *ptr1,*ptr2;
ptr1=calloc(MAX,1);
perror("calloc 1:");
ptr2=ptr1;
free(ptr1);
perror("free ");
ptr1=calloc(MAX,1);
perror(" calloc 2");
if(ptr1 == ptr2)
printf("\n Success");
else
printf("\n Failure");
}
=====================
fails in ppc 64 specifically. The test suite fails as ptr1 is not equal
to ptr2. Is calloc() expected to return same values on successive
allocation? as man page doesn't suggest any thing on this.
Please let us know of your opinion.
Regards
Sharyathi Nagesh