This is an archive of the discontinued LLVM Phabricator instance.

[AliasAnalysis] Initialize a member variable that may be used by unit test.
ClosedPublic

Authored by peter.smith on Aug 1 2019, 3:22 AM.

Details

Summary

The unit tests in BasicAliasAnalysisTest use the alias analysis API directly and do not call setAAResults to initalize AAR. This gives a valgrind error "Conditional Jump depends on unitialized variable". On most buildbots the variable is nullptr, but in some cases it can be non nullptr leading to seemingly random failures.

In this particular case it looks like initializing to nullptr is sound as results should be standalone unless they've been explicitly aggregated.

These tests were disabled in r366986 as some unrelated changes to the unittests changed the memory allocation and caused the two tests to start failing. With the initialization they can be enabled again.

Fixes PR42719

I know very little about AA myself, there may be a way of rewriting the UnitTests so that it doesn't hit an unitialized variable, or a better fix, I'd need to hand over to an expert for that. I've picked some reviewers from the history of the file.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Aug 1 2019, 3:22 AM
ormris added a subscriber: ormris.Aug 1 2019, 9:23 AM
asbirlea accepted this revision.Aug 1 2019, 10:38 AM

LGTM, thanks for the patch!

This revision is now accepted and ready to land.Aug 1 2019, 10:38 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2019, 1:05 AM