OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [memchr.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Copyright (C) 2007  Free Software Foundation.
2
 
3
   Ensure all expected transformations of builtin memchr occur
4
   and perform correctly.
5
 
6
   Written by Paolo Carlini, 10/5/2007.  */
7
 
8
extern void abort (void);
9
typedef __SIZE_TYPE__ size_t;
10
extern void *memchr (const void *, int, size_t);
11
 
12
void
13
main_test (void)
14
{
15
  const char* const foo1 = "hello world";
16
 
17
  if (memchr (foo1, 'x', 11))
18
    abort ();
19
  if (memchr (foo1, 'o', 11) != foo1 + 4)
20
    abort ();
21
  if (memchr (foo1, 'w', 2))
22
    abort ();
23
  if (memchr (foo1 + 5, 'o', 6) != foo1 + 7)
24
    abort ();
25
  if (memchr (foo1, 'd', 11) != foo1 + 10)
26
    abort ();
27
  if (memchr (foo1, 'd', 10))
28
    abort ();
29
  if (memchr (foo1, '\0', 11))
30
    abort ();
31
  if (memchr (foo1, '\0', 12) != foo1 + 11)
32
    abort ();
33
 
34
  /* Test at least one instance of the __builtin_ style.  We do this
35
     to ensure that it works and that the prototype is correct.  */
36
  if (__builtin_memchr (foo1, 'r', 11) != foo1 + 8)
37
    abort ();
38
}

powered by: WebSVN 2.1.0

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