OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [libgloss/] [testsuite/] [libgloss.all/] [memory.c] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/* WinBond bug report
2
 
3
   malloc() returns 0x0.
4
 
5
   test the memory calls. These test sbrk(), which is part of glue.c
6
   for most architectures.
7
 */
8
 
9
#include <stdio.h>
10
#define BUFSIZE 80
11
 
12
main()
13
{
14
  char *buf;
15
  char *tmp;
16
  char *result;
17
 
18
  /* see if we can get some memory */
19
  buf = (char *)malloc(BUFSIZE);
20
  if (buf != 0x0) {
21
    pass ("malloc");
22
  } else {
23
    fail ("malloc");
24
  }
25
 
26
  /* see if we can realloc it */
27
  tmp = buf;
28
  result = (char *)realloc (buf, BUFSIZE+100);
29
   if ((buf != 0x0) && (result != 0x0)) {
30
    pass ("realloc");
31
  } else {
32
    fail ("realloc");
33
  }
34
 
35
  /* see if we can free it up. FIXME: how to test free ?*/
36
  free (buf);
37
  fflush (stdout);
38
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.