Skip to content

Fix assert in bounds widening "BinaryNode operator must equal parent operator" #928

@secure-sw-dev-bot

Description

@secure-sw-dev-bot

This issue was copied from checkedc/checkedc-clang#932


Handle the following case in bounds widening:

void f(int i) {
  _Nt_array_ptr<char> p : count(0) = "a";

  if (*(p + (0 * 1)))
  {}
}

Currently, we hit an assert:

clang-9: /usr/local/magrang/master/src/clang/lib/AST/PreorderAST.cpp:46: void clang::PreorderAST::RemoveNode(clang::Node*, clang::Node*): Assertion `B->Opc == P->Opc && "BinaryNode operator must equal parent operator"' failed.

This is because we have incorrectly added the requirement that in order to remove a BinaryNode its opcode should be equal to its parent opcode which is not valid in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions