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
CodeQL reports incorrect struct size for std::function #11790
Comments
|
In playing around with this some more, I get different behavior for the compiled binary, in and out of |
|
Going from a fully clean install on Ubuntu 22, both sizeof() and CodeQL produce the same results. |
|
I wrote a quick tool to compare DWARF and CodeQL results (https://github.com/WilliamParks/Struct-Check), and it seems std::function is the only improperly sized struct in the large project I've been working with |
|
Hi @WilliamParks, Thanks for your question. There are two things going on here:
The second issue is in principle fixable. However, to properly prioritise this, would you mind explaining what your use-case is? |
|
Hi @jketema, I'm using CodeQL static analysis as part of a fuzzing research project. I've been doing development on an arm64 mac, but it'll actually run on an x86-64 system. Because of that, I think this is low priority. Thanks! |
|
Thanks for sketching the context in which you use this. I've opened some internal issues to track the problems you observed. |


I've got a test case where CodeQL reports different structure sizes than the actual compiler.
This is using a recent compile of LLVM 15.0.6, on an M1 Mac, as well as the default OS clang binary. I have a fresh install of CodeQL, version 2.11.6.
Notably, this only happens when using
clang++, and not when I useg++.Minimized source file:
Compilation command:
CodeQL query:
CodeQL Output
Running
clang_testNotably, the
g++compiled version reports the same size as CodeQL.The text was updated successfully, but these errors were encountered: