]>
Commit | Line | Data |
---|---|---|
47035bb8 ZW |
1 | /* Uninitialized variable warning tests... |
2 | Inspired by part of optabs.c:expand_binop. | |
3 | May be the same as uninit-1.c. */ | |
4 | ||
5 | /* { dg-do compile } */ | |
6 | /* { dg-options "-O -Wuninitialized" } */ | |
7 | ||
8 | #include <limits.h> | |
9 | ||
10 | void | |
11 | add_bignums (int *out, int *x, int *y) | |
12 | { | |
13 | int p, sum; | |
6de9cd9a | 14 | int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */ |
47035bb8 ZW |
15 | |
16 | p = 0; | |
17 | for (; *x; x++, y++, out++, p++) | |
18 | { | |
19 | if (p) | |
20 | sum = *x + *y + carry; | |
21 | else | |
22 | sum = *x + *y; | |
23 | ||
24 | if (sum < 0) | |
25 | { | |
26 | carry = 1; | |
27 | sum -= INT_MAX; | |
28 | } | |
29 | else | |
30 | carry = 0; | |
31 | } | |
32 | } |