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/] [strcmp.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2000, 2003, 2004  Free Software Foundation.
2
 
3
   Ensure all expected transformations of builtin strcmp
4
   occur and perform correctly.
5
 
6
   Written by Jakub Jelinek, 11/7/2000.  */
7
 
8
extern void abort (void);
9
extern int strcmp (const char *, const char *);
10
 
11
int x = 7;
12
char *bar = "hi world";
13
 
14
void
15
main_test (void)
16
{
17
  const char *const foo = "hello world";
18
 
19
  if (strcmp (foo, "hello") <= 0)
20
    abort ();
21
  if (strcmp (foo + 2, "llo") <= 0)
22
    abort ();
23
  if (strcmp (foo, foo) != 0)
24
    abort ();
25
  if (strcmp (foo, "hello world ") >= 0)
26
    abort ();
27
  if (strcmp (foo + 10, "dx") >= 0)
28
    abort ();
29
  if (strcmp (10 + foo, "dx") >= 0)
30
    abort ();
31
  if (strcmp (bar, "") <= 0)
32
    abort ();
33
  if (strcmp ("", bar) >= 0)
34
    abort ();
35
  if (strcmp (bar+8, "") != 0)
36
    abort ();
37
  if (strcmp ("", bar+8) != 0)
38
    abort ();
39
  if (strcmp (bar+(--x), "") <= 0 || x != 6)
40
    abort ();
41
  if (strcmp ("", bar+(++x)) >= 0 || x != 7)
42
    abort ();
43
 
44
  /* Test at least one instance of the __builtin_ style.  We do this
45
     to ensure that it works and that the prototype is correct.  */
46
  if (__builtin_strcmp (foo, "hello") <= 0)
47
    abort ();
48
}

powered by: WebSVN 2.1.0

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