PR tree-optimization/86401
[official-gcc.git] / gcc / testsuite / c-c++-common / pr43772.c
blob8bf09a420f3ab1511f2963aabd14b844f7a2135e
1 /* { dg-do compile } */
2 /* { dg-options "-Wlogical-op -Wtype-limits" } */
3 #include <limits.h>
4 long long
5 emacs_lseek (long long offset)
7 return -1-9223372036854775807LL <= offset && offset <= 9223372036854775807LL;
10 long long
11 foo (long long offset)
13 return -1-9223372036854775807LL > offset && offset > 9223372036854775807LL;
16 long long
17 foo3 (long long offset)
19 return -1-9223372036854775807LL > offset && offset < 9223372036854775807LL;
22 long long
23 foo2 (long long offset)
25 if (-1-9223372036854775807LL <= offset) return 0;
26 if (offset <= 9223372036854775807LL) return 0;
27 if (-1-9223372036854775807LL > offset) return 0;
28 if (offset > 9223372036854775807LL) return 0;
29 return 1;
32 # define BOT INT_MIN
33 # define TOP INT_MAX
35 long long get_intmax(void);
36 int get_int(void);
37 extern void do_something(void);
38 int main(void)
40 int i = get_int();
41 long long x = get_intmax();
42 i = (i > BOT && i < TOP); //OK
43 i = (i >= BOT+1 && i <= TOP-1); //OK
44 i = (i >= BOT && i <= TOP); //Oops!