gcc/libmudflap/testsuite/libmudflap.c/heap-scalestress.c
Rainer Orth 891a2e4259 re PR libmudflap/49550 (Many libmudflap tests fail on Solaris 11/x86)
gcc:
	PR libmudflap/49550
	* gcc.c (MFWRAP_SPEC): Also wrap mmap64.

	libmudflap:
	PR libmudflap/49550
	* mf-runtime.c (__wrap_main) [__sun__ && __svr4__]: Don't register
	stdin, stdout, stderr.
	Register __ctype, __ctype_mask.

	* configure.ac: Check for mmap64.
	Check for rawmemchr, stpcpy, mempcpy.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* mf-hooks1.c [HAVE_MMAP64] (__mf_0fn_mmap64): New function.
	(mmap64): New wrapper function.
	* mf-impl.h (__mf_dynamic_index) [HAVE_MMAP64]: Add dyn_mmap64.
	* mf-runtime.c (__mf_dynamic) [HAVE_MMAP64]: Handle mmap64.

	* mf-hooks2.c [HAVE_GETMNTENT && HAVE_SYS_MNTTAB_H]: Implement
	getmntent wrapper.

	* mf-hooks3.c (_REENTRANT): Define.

	* testsuite/libmudflap.c/heap-scalestress.c (SCALE): Reduce to 10000.

	* testsuite/libmudflap.c/pass-stratcliff.c: Include ../config.h.
	(MIN): Define.
	Use HAVE_RAWMEMCHR, HAVE_STPCPY, HAVE_MEMPCPY as guards.

	* testsuite/libmudflap.c/pass47-frag.c: Expect __ctype warning on
	*-*-solaris2.*.

From-SVN: r175961
2011-07-07 10:14:02 +00:00

80 lines
1.1 KiB
C

/* zz30
*
* demonstrate a splay-tree depth problem
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#ifndef SCALE
#define SCALE 10000
#endif
struct list
{
struct list *next;
};
int
main ()
{
struct list *head = NULL;
struct list *tail = NULL;
struct list *p;
long n;
int direction;
for (direction = 0; direction < 2; direction++)
{
fprintf (stdout, "allocating\n");
fflush (stdout);
for (n = 0; n < SCALE; ++n)
{
p = malloc (sizeof *p);
if (NULL == p)
{
fprintf (stdout, "malloc failed\n");
break;
}
if (direction == 0)
{ /* add at tail */
p->next = NULL;
if (NULL != tail)
tail->next = p;
else
head = p;
tail = p;
}
else
{ /* add at head */
p->next = head;
if (NULL == tail)
tail = p;
head = p;
}
}
fprintf (stdout, "freeing\n");
fflush (stdout);
while (NULL != head)
{
p = head;
head = head->next;
free (p);
}
}
fprintf (stdout, "done\n");
fflush (stdout);
return (0);
}
/* { dg-output "allocating.*freeing.*allocating.*freeing.*done" } */