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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [20040121-1.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
 
2
 
3
/* Test that (p!=0) + (q!=0) is computed as int,
4
    not boolean */
5
/* { dg-options "-O3" } */
6
/* { dg-do run } */
7
extern void abort (void);
8
char *foo(char *p, char *q) {
9
    int x = (p !=0) + (q != 0);
10
    if (x==2)  return "a"; else return 0;
11
}
12
extern char *bar(char*, char*) __attribute__((noinline));
13
char *bar(char *first, char *last)
14
{
15
   int y;
16
   if (!first)  return last;
17
   if (!last)   return first;
18
   if (*first == 'a')
19
     return foo(first, last);
20
   return 0;
21
}
22
main() {
23
   char *p = "a", *q = "b";
24
   if (p)
25
     if (bar(p,q))
26
       return 0;
27
   abort();
28
}

powered by: WebSVN 2.1.0

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