-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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++ extraction aborted for compiler invocation when using std::format #18244
Comments
Hi @ryftchen std::format is supported, but it seems that you ran into some problem with the C/C++ front end we're using. Unfortunately, we cannot debug this without further details. What version of CodeQL are you using, and what is the C++ compiler (including its version number) that you're using? Also, which platform are you on (Linux, Windows, macOS)? |
Hi @jketema CodeQL version: 2.18.4 (cpp-queries 1.2.2) P.S: For affected cpp files, after changes to parts unrelated to std::format sometimes don't result in an extraction aborted issue. There seems to be no pattern to the reproduction. But removing std::format does not cause the extraction aborted issue. |
Thanks. Quite a few fixes have gone in since 2.18.4, would you be able to try with the latest version? Also, a copy of the build-tracer.log file, which will be in the database directory would help. It should give the actual error before the abort happened. |
@jketema |
Hi the log seems for 2.18.0, and not 2.19.4, which is the current latest version (2.20.0 should be released in the next few days). In the log I see two errors. The majority of which are
These are are coming from CMake test compilations, so are harmless. They likely also fail to compile when compiled with clang, and seem unrelated to the The other errors are (6 of them):
These also seem unrelated to So from this it doesn't seem there is a problem with |
Hi, thank you for your support. This is a good catch, but I'm afraid that the issue doesn't seem to be with this file. I checked again and noticed that the log file seemed to contain log content from earlier versions, so I confirmed the execution time and got the log for version 2.20.0 only: build-tracer.log.zip
|
This is a crash in our tooling. To fix this, I would need a test case that reproduces the problem. The logs do not contain enough information to track down the issue. |
Is any other information needed? So far, this has only been found to happen when using the std::format function, not when using std::string splicing. Only a part of the cpp files are affected. |
Yes, as I mentioned above, you'll need to provide a test case that reproduces the problem, because the logs do not provide sufficient information, and I have not been able to reproduce the problem locally. |
Okay, I'll try to make a simple case, but I'm afraid it's a little hard to find the reproduction condition from the code project. |
A possible approach to this is to preprocess one of the files on which the problem occurs with clang ( |
Thanks for the suggestion, unfortunately using the precompiled content as a new file doesn't seem to reproduce the crash: issue.cpp.zip The compile command is simplified to: As with the precompilation, if replacing the single call to std::format in the corresponding source file with a string splice, there is no issue. It was also found that even if the version is the same, but the device on which it is running is different (e.g. in a WSL or in a Docker container), the files affected are different. |
Question for my understanding, to make sure nothing is lost in translation: are you running on the same machine, just using WSL or Docker, or is it a completely different machine? |
It is a completely different machine, but the running environment is the same. Specifically, I tried to run the same version in the WSL (Ubuntu 22.04 x86_64) of Windows or Docker container (Ubuntu 22.04 x86_64) of Mac. Assuming that there are a total of 5 cpp files calling the function where std::format is located, the results from the WSL and Docker runs show that the total number of exception files involved will be different on both sides, although both are less than 5. |
Description of the issue
Found that if the hpp file of the function that calls C++20 std::format is included in other cpp files, the result of "codeql database analyze" shows that the number of cpp files in this invocation is incomplete. At the same time, can find something similar to the following in the sarif file:
However, this issue does not occur when std::format is not used, is it currently supported? Thank you.
The text was updated successfully, but these errors were encountered: