blob: 11eec50b0f21c350507480e768df8db4344a94e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* 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;
}
int
main() {
char *p = "a", *q = "b";
if (p)
if (bar(p,q))
return 0;
abort();
}
|