We current handle 0 size non-POD arrays as if they had 1 element, which leads to false positives.
See https://godbolt.org/z/6E98xY66W for one example.
This patch fixes this bug.
Differential D131501
[analyzer] Fix for incorrect handling of 0 length non-POD array construction isuckatcs on Aug 9 2022, 8:39 AM. Authored by
Details We current handle 0 size non-POD arrays as if they had 1 element, which leads to false positives. See https://godbolt.org/z/6E98xY66W for one example. This patch fixes this bug.
Diff Detail
Event TimelineComment Actions Thanks for the patch.
Comment Actions
Comment Actions Brilliant catch as always!
Comment Actions Rebase and addressed some comments.
Comment Actions @xazax.hun I added a test case for how I imagine flexible non-POD array members in C++ Comment Actions Thanks! I think the test case could be simplified a bit, I am not sure whether we need offsetof, but otherwise looks good to me.
|
Consider moving this comment to the condition where you check Size == 0.