[cfe-dev] [analyzer] Aliasing leads to analyzer failures

Vince Bridgers via cfe-dev cfe-dev at lists.llvm.org
Sat Feb 15 12:55:46 PST 2020

Hello, I think this case is very similar (if not the same) to case 2
described in this fogbugz case: https://bugs.llvm.org/show_bug.cgi?id=43364

Artem, could you confirm? Any tips on where to get started looking at this

clang -cc1 -analyze  -analyzer-checker=core    test.c
test.c:13:7: warning: Branch condition evaluates to a garbage value
  if (p[1])
1 warning generated.

The reproducer …
struct S {
  unsigned short val;
int main(void)
  struct S var = { 0x1122 };
  char *p = (char *)&var;
  int x = 0;
  if (p[0])
  if (p[1])
  return x;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200215/52fb4e60/attachment.html>

More information about the cfe-dev mailing list