| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-fnon-call-exceptions -Wuninitialized" } |
| 3 |
|
| 4 |
extern void printval(unsigned char v); |
| 5 |
|
| 6 |
inline int readbyte(unsigned char *__restrict presult, |
| 7 |
unsigned char volatile *ptr) |
| 8 |
{ |
| 9 |
unsigned char v; |
| 10 |
try { |
| 11 |
v = *ptr; |
| 12 |
} catch (...) { |
| 13 |
return -1; |
| 14 |
} |
| 15 |
*presult = v; |
| 16 |
return 0; |
| 17 |
} |
| 18 |
|
| 19 |
int incorrectWarning(unsigned char volatile *ptr) |
| 20 |
{ |
| 21 |
int error; |
| 22 |
unsigned char first; |
| 23 |
unsigned char second; |
| 24 |
|
| 25 |
error = readbyte(&first, ptr); |
| 26 |
asm("\n\n\n\n\n" : : "X" (error != 0)); |
| 27 |
if (error != 0) |
| 28 |
goto err; |
| 29 |
|
| 30 |
error = readbyte(&second, ptr); |
| 31 |
if (error != 0) |
| 32 |
goto err; |
| 33 |
|
| 34 |
printval(first); // { dg-bogus "uninitialized" } |
| 35 |
printval(second); |
| 36 |
return 0; |
| 37 |
|
| 38 |
err: |
| 39 |
return error; |
| 40 |
} |