This is an archive of the discontinued LLVM Phabricator instance.

[SmallVector] Add default initialization of SmallVectorStorage::InlineElts
AbandonedPublic

Authored by maksimsab on Jan 23 2023, 6:55 AM.

Details

Reviewers
chandlerc
nikic
Summary

This change mitigates a Coverity diagnostic about reading uninitialized memory (https://cwe.mitre.org/data/definitions/457.html).
The following snippet demonstrates the case.

SmallVector<int, 4> func(int a) {

if (a == 0) {
  return {};  // To get around RVO.
}

SmallVector<int, 4> ret;
return ret;

}

Diff Detail

Event Timeline

maksimsab created this revision.Jan 23 2023, 6:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2023, 6:55 AM
maksimsab requested review of this revision.Jan 23 2023, 6:55 AM
nikic requested changes to this revision.Jan 23 2023, 7:00 AM
nikic added a subscriber: nikic.

This memory should certainly not be initialized.

This revision now requires changes to proceed.Jan 23 2023, 7:00 AM
maksimsab abandoned this revision.Feb 1 2023, 5:25 AM