Open Quuxplusone opened 3 years ago
Could you please attach the preprocessed source code of the code?
The invocation is might not be strictly necessary, but useful as well.
Also, which clang-tidy did you use? Do you have a commit hash?
/CC Denys, who worked on void dereference assertions in the past
Thanks for adding me!
We've recently been not able to reproduce such assertion in one another case,
so we just add a repro-test for the future, hoping to catch it.
https://reviews.llvm.org/D104381
Actually I didn't work on this but I don't mind to dig into the problem. I'll
put it into my backlog and handle ASAP.
Attached ast-dump.txt.gz
(555027 bytes, text/plain): ast-dump
Attached ex.cpp
(183 bytes, text/x-c++src): testcase
Attached 1.jpeg
(72297 bytes, image/jpeg): screenshot
I could not reproduce it on godbolt, probably because the crash depends on VS
2010:ostream.
https://godbolt.org/z/sbWfTq7j5 - no crash even with assertions.
Reconstructing the source code from the AST dump is more than tedious IMO.
I would rather request a preprocessed version of the reproducer file.
You can acquire it by passing the '-E' flag to the invocation, then the '-o'
for specifying the name of the output file.
Let me know how it goes!
BTW thank you for reporting the issue.
Attached ex-preprocessed.cpp
(565026 bytes, text/x-c++src): preprocessed testcase
It is vs 2010 specific.
I'm mainly a Linux user.
And I'm having difficulties with specifying the correct options to analyze the
attached code.
I tried something like this:
./bin/clang -cc1 -analyze -setup-static-analyzer -analyzer-checker=core ex-preprocessed.cpp -std=c++14 -triple x86_64-pc-windows-msvc19.11.0 -fms-compatibility -fms-extensions
However, it still reports errors:
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include\xmemory:37:3:
error: cannot use 'throw' with exceptions disabled
throw bad_alloc(0);
Or:
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include\xlocale:263:17: error: no template named 'collate' in namespace 'std'
const ::std:: collate<_Elem>& _Coll_fac =
Even if I specify the '-fexceptions' flag, remains the same.
Could you please provide a clang invocation?
I managed to build the preprocessed file as
clang-cl /EHsc -c ex-preprocessed.cpp --analyze -Xclang -analyzer-output=text
after deleting the two lines that define char16_t and char32_t respectively.
(clang-cl is the variant of the clang driver that tries to emulate the
Microsoft compiler instead of GCC)
It doesn't crash on me anyway though.
Preprocessed files are typically very reliable so unless your full compile
command reveals something exotic, I suspect that your Clang isn't fresh enough.
In any case, please mention clang version and full invocation.
ast-dump.txt.gz
(555027 bytes, text/plain)ex.cpp
(183 bytes, text/x-c++src)1.jpeg
(72297 bytes, image/jpeg)ex-preprocessed.cpp
(565026 bytes, text/x-c++src)