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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [strstr-asm.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2000, 2003  Free Software Foundation.
2
 
3
   Ensure all expected transformations of builtin strstr occur and
4
   perform correctly in presence of redirect.  */
5
/* { dg-options "-ffat-lto-objects" } */
6
 
7
#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
8
#define ASMNAME2(prefix, cname) STRING (prefix) cname
9
#define STRING(x)    #x
10
 
11
typedef __SIZE_TYPE__ size_t;
12
extern void abort (void);
13
extern char *strstr (const char *, const char *)
14
  __asm (ASMNAME ("my_strstr"));
15
 
16
const char *p = "rld", *q = "hello world";
17
 
18
void
19
main_test (void)
20
{
21
  const char *const foo = "hello world";
22
 
23
  if (strstr (foo, "") != foo)
24
    abort ();
25
  if (strstr (foo + 4, "") != foo + 4)
26
    abort ();
27
  if (strstr (foo, "h") != foo)
28
    abort ();
29
  if (strstr (foo, "w") != foo + 6)
30
    abort ();
31
  if (strstr (foo + 6, "o") != foo + 7)
32
    abort ();
33
  if (strstr (foo + 1, "world") != foo + 6)
34
    abort ();
35
  if (strstr (foo + 2, p) != foo + 8)
36
    abort ();
37
  if (strstr (q, "") != q)
38
    abort ();
39
  if (strstr (q + 1, "o") != q + 4)
40
    abort ();
41
 
42
  /* Test at least one instance of the __builtin_ style.  We do this
43
     to ensure that it works and that the prototype is correct.  */
44
  if (__builtin_strstr (foo + 1, "world") != foo + 6)
45
    abort ();
46
}

powered by: WebSVN 2.1.0

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