This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Fix uninitialized member variable use in RVVEmitter::createRVVIntrinsics()
ClosedPublic

Authored by schittir on Mar 24 2023, 2:19 PM.

Diff Detail

Event Timeline

schittir created this revision.Mar 24 2023, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2023, 2:19 PM
schittir requested review of this revision.Mar 24 2023, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2023, 2:19 PM

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?

schittir updated this revision to Diff 508215.Mar 24 2023, 2:29 PM

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?

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?

Coverity complains about SR.PolicyBitMask being uninitialized when calling SemaRecords->push_back(SR)

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?

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.

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?

Coverity complains about SR.PolicyBitMask being uninitialized when calling SemaRecords->push_back(SR)

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++...)

schittir updated this revision to Diff 508221.Mar 24 2023, 2:50 PM

Deleting the member PolicyBitMask

aaron.ballman accepted this revision.Mar 27 2023, 8:24 AM

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.

This revision is now accepted and ready to land.Mar 27 2023, 8:24 AM
This revision was landed with ongoing or failed builds.Mar 27 2023, 2:40 PM
This revision was automatically updated to reflect the committed changes.