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] - Rev 149

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

 
 
/* Test that (p!=0) + (q!=0) is computed as int,
    not boolean */
/* { dg-options "-O3" } */
/* { dg-do run } */
extern void abort (void);
char *foo(char *p, char *q) {
    int x = (p !=0) + (q != 0);
    if (x==2)  return "a"; else return 0;
}
extern char *bar(char*, char*) __attribute__((noinline));
char *bar(char *first, char *last)
{
   int y;
   if (!first)  return last;
   if (!last)   return first;
   if (*first == 'a')
     return foo(first, last);
   return 0;
}
main() {
   char *p = "a", *q = "b";
   if (p)
     if (bar(p,q))
       return 0;
   abort();
}
 

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

powered by: WebSVN 2.1.0

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