This revision was automatically updated to reflect the committed changes.
Closed by commit rC333417: [analyzer] const init: handle non-explicit cases
more accurately (authored by r.stahl, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D46823
Files:
lib/StaticAnalyzer/Core/Reg
r.stahl updated this revision to Diff 148809.
r.stahl added a comment.
Added FIXME tests.
I know my example didn't exercise your scenario, but it was the only one I
could think of where returning zero would have been straight up wrong. Note
that I default initialized `a` to 3 there, so `sarr` i
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
Looks good!
Do you have commit access? I think you should get commit access.
Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1650
+
+// If there is a list, but no
r.stahl added inline comments.
Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1650
+
+// If there is a list, but no init, it must be zero.
+if (i >= InitList->getNumInits())
NoQ wrote:
> NoQ wrote:
> > Would this work correctly if the
r.stahl updated this revision to Diff 146809.
r.stahl marked 2 inline comments as done.
r.stahl added a comment.
updated test
https://reviews.llvm.org/D46823
Files:
lib/StaticAnalyzer/Core/RegionStore.cpp
test/Analysis/initialization.c
Index: test/Analysis/initialization.c
===
NoQ added a comment.
Yay thanks!
I think some cornercases would need to be dealt with.
Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1650
+
+// If there is a list, but no init, it must be zero.
+if (i >= InitList->getNumInits())
N
r.stahl created this revision.
r.stahl added reviewers: NoQ, xazax.hun, george.karpenkov.
Herald added subscribers: cfe-commits, a.sidorin, rnkovacs, szepet.
If the access is out of bounds, return UndefinedVal. If it is missing an
explicit init, return the implicit zero value it must have.
Repo