This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix a flaky heap-overflow-large.cc test
ClosedPublic

Authored by kubamracek on Mar 22 2015, 2:59 AM.

Details

Reviewers
samsonov
Summary

The regression test in test/asan/TestCases/heap-overflow-large.cc returns an exit code with this statement:

return res ? res : 1;

with the intention of always returning a non-zero exit code, no matter what res is (it's a result of a pretty much random memory read). However, when res is accidentally a multiple of 256, then (at least on Darwin) this will be treated as a zero exit code. Let's change the test to only return one byte of res and not the whole int.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 22418.Mar 22 2015, 2:59 AM
kubamracek retitled this revision from to [compiler-rt] Fix a flaky heap-overflow-large.cc test.
kubamracek updated this object.
kubamracek edited the test plan for this revision. (Show Details)
kubamracek added subscribers: Unknown Object (MLST), samsonov, glider and 2 others.

Nice catch! I'd go for smth. simpler than that, e.g.

unsigned res = x[index];
return (res % 10) + 1;

Updating patch.

Ah, forgot the unsigned...

samsonov accepted this revision.Mar 22 2015, 10:56 AM
samsonov added a reviewer: samsonov.

LGTM

This revision is now accepted and ready to land.Mar 22 2015, 10:56 AM
kubamracek closed this revision.Mar 22 2015, 11:03 AM

Landed in r232920.