Closed dcb314 closed 2 weeks ago
@llvm/issue-subscribers-clang-frontend
Author: None (dcb314)
This indeed looks like a bug, everywhere else Cand->Function
is checked before using it.
This came in w/ d0223b9ffc401
CC @cor3ntin
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
test/
create fine-grained testing targets, so you can e.g. use make check-clang-ast
to only run Clang's AST tests.git clang-format HEAD~1
to format your changes.If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: None (dcb314)
I'm looking into this issue. The issue is Cand->Function
nott being checking in this case am I right?
I'm looking into this issue. The issue is
Cand->Function
nott being checking in this case am I right?
Yes, something like this:
As a side note, I think it is unfortunate in some place in SemaOverload.cpp
they check Cand->Function
and then pass Cand
and then within the called function they can now assume Cand->Function
is valid. I think it would have been a better choice to pass Cand->Function
as a another argument maybe FunctionDecl *Fn
and then use that.
It obscures when Cand->Function
can be assumed valid or not, you really have to check across the code to know.
https://github.com/llvm/llvm-project/pull/98965 claims it fixes this.
cvise $ /home/dcb40b/valgrind/results/bin/valgrind -q --trace-children=yes /home/dcb40b/llvm/results/bin/clang++ -c bug157.cc ==1668426== Conditional jump or move depends on uninitialised value(s) ==1668426== at 0x47E3526: NoteFunctionCandidate (SemaOverload.cpp:11961) ==1668426== by 0x47E3526: clang::OverloadCandidateSet::NoteCandidates(clang::Sema&, llvm::ArrayRef<clang::Expr>, llvm::ArrayRef<clang::OverloadCandidate>, llvm::StringRef, clang::SourceLocation) (SemaOverload.cpp:12591)
bug157.cc.gz
File SemaOverload.cpp, line 11961 is
This bug has existed since sometime before git hash 005758eb6b35aaf548c3a59da860ecd2465a73f0, dated 20240614.