Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-cpp] Overloads in vtable building lead to assertion error. #1749

Open
intrigus-lgtm opened this issue Mar 17, 2024 · 0 comments
Open

Comments

@intrigus-lgtm
Copy link
Contributor

Running this code

struct c
{
  virtual int d();
  virtual int d(int);
};

results in:

esbmc: esbmc/src/clang-cpp-frontend/clang_cpp_convert_vft.cpp:585: void clang_cpp_convertert::add_vtable_variable_symbols(const clang::CXXRecordDecl&, const struct_typet&, const switch_table&): Assertion `value.type() == compo.type()' failed.

The reason pretty much is that the current code does not handle overloads.
method_name is just d in both cases.

comp.type().set("#virtual_name", method_name);

comp.set("virtual_name", method_name);

(I don't know which of the two lines is the exact culprit but it doesn't really matter)

The end result is that there is only one entry for d in the switch_map here and so we are guaranteed to find a wrong type:

switch_map.find(compo.get("virtual_name").as_string());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant