1 |
689 |
jeremybenn |
/* PR 16302 */
|
2 |
|
|
/* { dg-do compile } */
|
3 |
|
|
/* { dg-options "-Wlogical-op" } */
|
4 |
|
|
void bar (int);
|
5 |
|
|
int
|
6 |
|
|
foo (int argc, char *argv[])
|
7 |
|
|
{
|
8 |
|
|
if (argc != 1 || argc != 2) return 1; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
9 |
|
|
if (argc < 0 && argc > 10) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
10 |
|
|
if (argc || !argc) return 1; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
11 |
|
|
if (argc && !argc) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
12 |
|
|
bar (argc != 1 || argc != 2); /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
13 |
|
|
bar (argc < 0 && argc > 10); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
14 |
|
|
bar (argc || !argc); /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
15 |
|
|
bar (argc && !argc); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
16 |
|
|
return (argc != 1 || argc != 2) ? 1 : 0 ; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
17 |
|
|
return (argc < 0 && argc > 10) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
18 |
|
|
return (argc || !argc) ? 1 : 0; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
19 |
|
|
return (argc && !argc) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
20 |
|
|
|
21 |
|
|
if (argc == 2 && argc == 1) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
22 |
|
|
if (argc < 0 && argc > 10) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
23 |
|
|
if (argc || !argc) return 1; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
24 |
|
|
if (argc && !argc) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
25 |
|
|
bar (argc == 2 && argc == 1); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
26 |
|
|
bar (argc < 0 && argc > 10); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
27 |
|
|
bar (argc || !argc); /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
28 |
|
|
bar (argc && !argc); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
29 |
|
|
return (argc == 2 && argc == 1) ? 1 : 0 ; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
30 |
|
|
return (argc < 0 && argc > 10) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
31 |
|
|
return (argc || !argc) ? 1 : 0; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
32 |
|
|
return (argc && !argc) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
33 |
|
|
|
34 |
|
|
if (argc == 2 && argc == 1) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
35 |
|
|
if (argc < 0 && argc > 10) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
36 |
|
|
if (!argc || argc) return 1; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
37 |
|
|
if (!argc && argc) return 1; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
38 |
|
|
bar (argc == 2 && argc == 1); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
39 |
|
|
bar (argc < 0 && argc > 10); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
40 |
|
|
bar (!argc || argc); /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
41 |
|
|
bar (!argc && argc); /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
42 |
|
|
return (argc == 2 && argc == 1) ? 1 : 0 ; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
43 |
|
|
return (argc < 0 && argc > 10) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
44 |
|
|
return (!argc || argc) ? 1 : 0; /* { dg-warning "'or' of collectively exhaustive tests is always true" } */
|
45 |
|
|
return (!argc && argc) ? 1 : 0; /* { dg-warning "'and' of mutually exclusive tests is always false" } */
|
46 |
|
|
|
47 |
|
|
return 0;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
int
|
51 |
|
|
foo2 (int argc)
|
52 |
|
|
{
|
53 |
|
|
if (5 != 1 || 5 != 2) return 1;
|
54 |
|
|
if (5 < 0 && 5 > 10) return 1;
|
55 |
|
|
if (1 || 0) return 1;
|
56 |
|
|
if (0 && 1) return 1;
|
57 |
|
|
if (2 || !2) return 1;
|
58 |
|
|
if (2 && !2) return 1;
|
59 |
|
|
if (!(!2) || !(2)) return 1;
|
60 |
|
|
if (!(!2) && !(2)) return 1;
|
61 |
|
|
bar (5 != 1 || 5 != 2);
|
62 |
|
|
bar (5 < 0 && 5 > 10);
|
63 |
|
|
bar (1 || 0);
|
64 |
|
|
bar (0 && 1);
|
65 |
|
|
bar (2 || !2);
|
66 |
|
|
bar (2 && !2);
|
67 |
|
|
return (5 != 1 || 5 != 2) ? 1 : 0 ;
|
68 |
|
|
return (5 < 0 && 5 > 10) ? 1 : 0;
|
69 |
|
|
return (1 || 0) ? 1 : 0 ;
|
70 |
|
|
return (0 && 1) ? 1 : 0;
|
71 |
|
|
return (2 || !2) ? 1 : 0;
|
72 |
|
|
return (2 && !2) ? 1 : 0;
|
73 |
|
|
|
74 |
|
|
return 0;
|
75 |
|
|
}
|
76 |
|
|
|