Found by Coverity static analysis tool.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
None of the other fields are initialised, so blindly initialising it alone to 0 here seems highly suspect. What's the actual case in which it's used whilst uninitialised?
The field should just be deleted. D126742 added it without any uses, and I don't know what the original intent was. Maybe it was used before the bitfields were added and it stuck around rather than being GC'ed. I don't know why Coverity would care about this though when it's never read from, there's nothing wrong with that, unless the warning is in fact that the field is entirely unreferenced?
Coverity complains about SR.PolicyBitMask being uninitialized when calling SemaRecords->push_back(SR)
Yea, that would make sense. I am up for deleting the field. Coverity does indeed complaining about uninitialized use of the SR.PolicyBitMask when calling push_back - surprisingly nothing about the field being unreferenced.
Isn't that precisely the case https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_222.htm makes legal? (Which I assume/hope applies equally to C++...)
LGTM, but you should fix up the commit message when you land since the patch has changed away from what's described in the summary.