| 1 |
/* PR tree-optimization/61112 - repeated conditional triggers false-positive |
| 2 |
-Wmaybe-uninitialized warning |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
int p; |
| 7 |
|
| 8 |
void foo_c0 (int x, int y, int z) |
| 9 |
{ |
| 10 |
int w; |
| 11 |
if (x) |
| 12 |
w = z; |
| 13 |
if (y) |
| 14 |
w = __LINE__; |
| 15 |
|
| 16 |
if (x || y) |
| 17 |
p = w; // { dg-bogus "-Wmaybe-uninitialized" } |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
void foo_c5_1_1 (int x, int y, int z, int a) |
| 22 |
{ |
| 23 |
int w; |
| 24 |
if (x) |
| 25 |
w = z; |
| 26 |
if (y) |
| 27 |
w = __LINE__; |
| 28 |
if (a) |
| 29 |
w = __LINE__; |
| 30 |
|
| 31 |
if (x || y || a) |
| 32 |
p = w; |
| 33 |
} |
| 34 |
|
| 35 |
void foo_c5_1_2 (int x, int y, int z, int a) |
| 36 |
{ |
| 37 |
int w; |
| 38 |
if (x) |
| 39 |
w = z; |
| 40 |
if (y) |
| 41 |
w = __LINE__; |
| 42 |
if (a) |
| 43 |
w = __LINE__; |
| 44 |
|
| 45 |
if (x || a || y) |
| 46 |
p = w; |
| 47 |
} |
| 48 |
|
| 49 |
void foo_c5_1_3 (int x, int y, int z, int a) |
| 50 |
{ |
| 51 |
int w; |
| 52 |
if (x) |
| 53 |
w = z; |
| 54 |
if (y) |
| 55 |
w = __LINE__; |
| 56 |
if (a) |
| 57 |
w = __LINE__; |
| 58 |
|
| 59 |
if (a || x || y) |
| 60 |
p = w; |
| 61 |
} |
| 62 |
|
| 63 |
void foo_c5_2 (int x, int y, int z, int a) |
| 64 |
{ |
| 65 |
int w; |
| 66 |
if (x) |
| 67 |
w = __LINE__; |
| 68 |
if (y) |
| 69 |
w = z; |
| 70 |
if (a) |
| 71 |
w = __LINE__; |
| 72 |
|
| 73 |
if (x || y || a) |
| 74 |
p = w; // { dg-bogus "-Wmaybe-uninitialized" } |
| 75 |
} |
| 76 |
|
| 77 |
void foo_c5_3 (int x, int y, int z, int a) |
| 78 |
{ |
| 79 |
int w; |
| 80 |
if (x) |
| 81 |
w = __LINE__; |
| 82 |
if (y) |
| 83 |
w = __LINE__; |
| 84 |
if (a) |
| 85 |
w = z; |
| 86 |
|
| 87 |
if (x || y || a) |
| 88 |
p = w; // { dg-bogus "-Wmaybe-uninitialized" } |
| 89 |
} |