aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr112792.c
blob: 0bc7413ce5dd0145403806b2c71cdc0230246e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* PR analyzer/112792 ("-Wanalyzer-out-of-bounds false positives seen on
   Linux kernel with certain unions").  */

typedef unsigned int u32;

union msix_perm {
  struct {
    u32 rsvd2 : 8;
    u32 pasid : 20;
  };
  u32 bits;
} __attribute__((__packed__));

union msix_perm mperm;

void idxd_device_set_perm_entry(u32 pasid) {
  mperm.pasid = pasid; /* { dg-bogus "buffer-overflow" } */
}