Skip to content

No error/warning on duplicate declaration of local variable #8129

@cesaro

Description

@cesaro

The below program doesn't compile, as a local variable is declared twice

int main() {

  int a = 10;

  // gcc: main.c:140:7: error: redeclaration of 'a' with no linkage
  // cbmc: no warning or error
  int a;

  a++;

  return 0;
}

but, while gcc errors, CBMC latest develop, in Linux, doesn't raise any warning or error about it.

Sure enough, all programs that one passes to the tool should already compile, but from time to time that's not the case. Probably CBMC should error here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions