gcc/testsuite/gcc.dg/analyzer/torture/uninit-pr108725.c
raw| 1 | /* Reduced from an example in qemu-7.2.0: dump/win_dump.c */ |
| 2 | |
| 3 | #include <stdbool.h> |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | extern int cpu_memory_rw_debug (bool x64, void *ptr); |
| 7 | |
| 8 | int cpu_read_ptr(bool x64, uint64_t *ptr) |
| 9 | { |
| 10 | int ret; |
| 11 | uint32_t ptr32; |
| 12 | uint64_t ptr64; |
| 13 | |
| 14 | ret = cpu_memory_rw_debug(x64, x64 ? (void *)&ptr64 : (void *)&ptr32); |
| 15 | |
| 16 | *ptr = x64 ? ptr64 : ptr32; /* { dg-bogus "use of uninitialized value" } */ |
| 17 | |
| 18 | return ret; |
| 19 | } |