Parsing fails for array of structs

5 views
Skip to first unread message

Bajczi Levente

unread,
Apr 25, 2024, 5:26:45 AMApr 25
to cpacheck...@googlegroups.com
Hi,

I've been looking at the following program excerpt:
void reach_error(){}
struct A{
int a;
};
struct A structs[1];
int main() {
  if(structs->a != 0) {
reach_error();
}
}

When given to CPAchecker, it says:

Error: Parsing failed (line 9: Pointer dereference of non-pointer type (struct A)[1]: structs->a (full line is if(structs->a != 0) {
      reach_error();
  })) (EclipseCParser.buildCFA, SEVERE)

However, both clang and gcc parse and compile this program without any errors or warnings (using `-Wall`). 

Best,
Levente
Reply all
Reply to author
Forward
0 new messages