Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / 20040121-1.c
blob11eec50b0f21c350507480e768df8db4344a94e1
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;
12 extern char *bar(char*, char*) __attribute__((noinline));
13 char *bar(char *first, char *last)
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;
22 int
23 main() {
24 char *p = "a", *q = "b";
25 if (p)
26 if (bar(p,q))
27 return 0;
28 abort();