[MIRSampleProfile] nullptr deref crash when profile sample use file not found
Trying to reproduce https://github.com/llvm/llvm-project/issues/188897, I failed to pass a valid file for -fprofile-sample-use=; this caused a crash because Reader is nullptr in MIRProfileLoader::runOnFunction. Should be easy to guard against this I think. cc @htyu (author of 958a3d8e2dec95a878dfc9d823861b3a6c674534)
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:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
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: Nick Desaulniers (nickdesaulniers)
Does it reproduce in godbolt? If so it is always helpful to provide them.
$ clang++ -cc1 -emit-obj -fprofile-sample-use=/dev/foo -mllvm -enable-fs-discriminator=true -x c++ foo.i
is crashing for me at c1ebd2f1c07f1dc51df1c1a56891fe564cbadc19. Can't seem to get clang to crash on godbolt with these flags though.
// foo.i
void android_logger_list_alloc_internal() {}
@nickdesaulniers Hi, I'd like to work on this.
I would also like to take this issue.
I have locally fixed this issue and am preparing a PR
I want to work on this