gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr112792.c
raw| 1 | /* PR analyzer/112792 ("-Wanalyzer-out-of-bounds false positives seen on |
| 2 | Linux kernel with certain unions"). */ |
| 3 | |
| 4 | typedef unsigned int u32; |
| 5 | |
| 6 | union msix_perm { |
| 7 | struct { |
| 8 | u32 rsvd2 : 8; |
| 9 | u32 pasid : 20; |
| 10 | }; |
| 11 | u32 bits; |
| 12 | } __attribute__((__packed__)); |
| 13 | |
| 14 | union msix_perm mperm; |
| 15 | |
| 16 | void idxd_device_set_perm_entry(u32 pasid) { |
| 17 | mperm.pasid = pasid; /* { dg-bogus "buffer-overflow" } */ |
| 18 | } |