analyzer icon indicating copy to clipboard operation
analyzer copied to clipboard

Duplication in prefix-type­ suffix race warnings

Open sim642 opened this issue 9 months ago • 0 comments

Suppose:

struct S {
  char* f;
  char* g;
};

If an access to type suffix (char*) races with an access to prefix (struct S), then this is reported twice: at (struct S).f and (struct S).g. This can get quite excessive, e.g. with (struct _IO_FILE) and its 11 char* fields.

Unlike all other race checks, the ones between prefix and type suffix are special: same checks are performed at every field because each one is the intersection of such prefix and type suffix. Thus, we could try to avoid duplicating these warnings (and ideally may-race checks) if there are no accesses to the node ((struct S).f and (struct S).g) themselves. Although it is unclear what should be the memory location for these:

  1. Just choose one of the fields?
  2. Have memory locations ending with offset type instead like (struct S).(char*)?
  3. Group memory locations like (struct S).{f, g}?
  4. Have pairwise memory locations like (struct S) - (char*)?

However, it gets more complicated if (some) of the nodes also have accesses at them because those may be reported in a group that also contains accesses from prefix and type suffix.

sim642 avatar Sep 21 '23 14:09 sim642