This is an archive of the discontinued LLVM Phabricator instance.

[test] Use printf instead of C++ iostream, NFC.
ClosedPublic

Authored by Hahnfeld on Jul 26 2018, 11:04 AM.

Details

Summary

This test fails with libc++ when built with MemorySanitizer. This
is because we link to an uninstrumented version of the library
so msan detects a nested error when calling std::cout << "...".
This can be easily avoided by using good old printf.

Diff Detail

Repository
rL LLVM

Event Timeline

Hahnfeld created this revision.Jul 26 2018, 11:04 AM
Herald added subscribers: Restricted Project, llvm-commits. · View Herald TranscriptJul 26 2018, 11:04 AM
vsk accepted this revision.Jul 26 2018, 11:07 AM

Thanks, LGTM. So, am I understanding correctly that there are msan interceptors for printf, but not iostream?

This revision is now accepted and ready to land.Jul 26 2018, 11:07 AM
In D49867#1177081, @vsk wrote:

Thanks, LGTM. So, am I understanding correctly that there are msan interceptors for printf, but not iostream?

I'm not sure that there are interceptors for printf. I think the problem was that instrumented and inlined code from headers got mixed with uninstrumented code from the shared library.

vsk added a comment.Jul 26 2018, 11:14 AM
In D49867#1177081, @vsk wrote:

Thanks, LGTM. So, am I understanding correctly that there are msan interceptors for printf, but not iostream?

I'm not sure that there are interceptors for printf. I think the problem was that instrumented and inlined code from headers got mixed with uninstrumented code from the shared library.

Oh, whereas none of the printf logic is inline, so either all of it is instrumented or not instrumented. Sure, makes sense.

This revision was automatically updated to reflect the committed changes.