Checking for use of references to an automatic variable outside of its scope
| Bugzilla Link | 29069 |
| Version | unspecified |
| OS | All |
| Attachments | This archive contains the .cpp file and the makefile described above |
| Reporter | LLVM Bugzilla Contributor |
| CC | @devincoughlin |
Extended Description
Hello, I'd like clang's static code analyser to be able to detect use of references to an automatic variable outside of its scope. I've attached a test-case that shows a bit of code that takes pointer to an automatic variable and use that pointer outside the scope of the original automatic variable. I have also attached a make file that compiles the .cpp file so that it can be run with scan-build to run the static code analyser on the .cpp file.
Aleksei Sidorin is working on a checker for this in https://reviews.llvm.org/D19979
This particular example is also something the StackAddrEscapeChecker could be extended to check because the bad pointer persists across a function return.
assigned to @tkremenek