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

C Frontend fails to convert forward-declared enum type as part of fn-signature #1794

Open
fbrausse opened this issue Apr 24, 2024 · 1 comment
Labels
gnu Relies on features provided as GNU extensions

Comments

@fbrausse
Copy link
Member

Example:

enum E;

enum E (*f)(void);

int main()
{
}

Currently:

ESBMC version 7.5.0 64-bit x86_64 linux
Target: 64-bit little-endian x86_64-unknown-linux with esbmclibc
Parsing enum-fwd-decl.c
Converting
esbmc: /home/kane/scorch/esbmc/src/clang-c-frontend/clang_c_convert.cpp:831: virtual bool clang_c_convertert::get_type(const clang::QualType&, typet&): Assertion `the_type' failed.

Essentially, the q_type is null here:

clang::QualType q_type = ent.getDecl()->getIntegerType();

Context: trying to translate an unmodified Linux driver.

@fbrausse
Copy link
Member Author

With #1798 merged, the initial example works now. However, that PR only contains a work-around, which, in case the originally incomplete enum type is ever used within ESBMC, can lead to the same problems enum_type() has caused before. See #1758.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gnu Relies on features provided as GNU extensions
Projects
None yet
Development

No branches or pull requests

1 participant