| 1 | // Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842 |
| 2 | // |
| 3 | // RUN: %clang_msan -g %s -o %t |
| 4 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 5 | |
| 6 | struct iphdr { |
| 7 | unsigned char pad1: 2, ihl:4, pad2: 2; |
| 8 | }; |
| 9 | |
| 10 | int raw_send_hdrinc(unsigned long int length) { |
| 11 | struct iphdr iph; |
| 12 | if (iph.ihl * 4 > length) { |
| 13 | return 1; |
| 14 | } |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | int main(int argc, char *argv[]) { |
| 19 | return raw_send_hdrinc(length: 12); |
| 20 | } |
| 21 | |
| 22 | // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value |
| 23 | |