aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorKristóf Umann <dkszelethus@gmail.com>2024-09-19 10:04:47 +0200
committerGitHub <noreply@github.com>2024-09-19 10:04:47 +0200
commit752e10379c2ffb4f6eebf490f1fab7eb769dfbf6 (patch)
treef759a2641364272db4bf04893bd20489328e7af5 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent0a3b6af768c95f8d8260aa28adbccabd60f7e9e5 (diff)
downloadllvm-752e10379c2ffb4f6eebf490f1fab7eb769dfbf6.zip
llvm-752e10379c2ffb4f6eebf490f1fab7eb769dfbf6.tar.gz
llvm-752e10379c2ffb4f6eebf490f1fab7eb769dfbf6.tar.bz2
[analyzer] Explicitly register NoStoreFuncVisitor from alpha.unix.cst… (#108373)
…ring.UninitRead This is a drastic simplification of #106982. If you read that patch, this is the same thing with all BugReporterVisitors.cpp and SValBuilder.cpp changes removed! (since all replies came regarding changed to those files, I felt the new PR was justified) The patch was inspired by a pretty poor bug report on FFMpeg: ![image](https://github.com/user-attachments/assets/8f4e03d8-45a4-4ea2-a63d-3ab78d097be9) In this bug report, block is uninitialized, hence the bug report that it should not have been passed to memcpy. The confusing part is in line 93, where block was passed as a non-const pointer to seq_unpack_rle_block, which was obviously meant to initialize block. As developers, we know that clang likely didn't skip this function and found a path of execution on which this initialization failed, but NoStoreFuncVisitor failed to attach the usual "returning without writing to block" message. I fixed this by instead of tracking the entire array, I tracked the actual element which was found to be uninitialized (Remember, we heuristically only check if the first and last-to-access element is initialized, not the entire array). This is how the bug report looks now, with 'seq_unpack_rle_block' having notes describing the path of execution and lack of a value change: ![image](https://github.com/user-attachments/assets/8de5d101-052e-4ecb-9cd9-7c29724333d2) ![image](https://github.com/user-attachments/assets/8bf52a95-62de-44e7-aef8-03a46a3fa08e) Since NoStoreFuncVisitor was a TU-local class, I moved it back to BugReporterVisitors.h, and registered it manually in CStringChecker.cpp. This was done because we don't have a good trackRegionValue() function, only a trackExpressionValue() function. We have an expression for the array, but not for its first (or last-to-access) element, so I only had a MemRegion on hand.
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions