[PATCH] D49867: [test] Use printf instead of C++ iostream, NFC.

Jonas Hahnfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 11:04:43 PDT 2018


Hahnfeld created this revision.
Hahnfeld added reviewers: vsk, vitalybuka, kubamracek.
Herald added subscribers: Sanitizers, llvm-commits.

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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49867

Files:
  test/ubsan/TestCases/Misc/monitor.cpp


Index: test/ubsan/TestCases/Misc/monitor.cpp
===================================================================
--- test/ubsan/TestCases/Misc/monitor.cpp
+++ test/ubsan/TestCases/Misc/monitor.cpp
@@ -8,7 +8,7 @@
 // Linkage issue
 // XFAIL: openbsd
 
-#include <iostream>
+#include <cstdio>
 
 extern "C" {
 void __ubsan_get_current_report_data(const char **OutIssueKind,
@@ -26,9 +26,9 @@
   __ubsan_get_current_report_data(&IssueKind, &Message, &Filename, &Line, &Col,
                                   &Addr);
 
-  std::cout << "Issue: " << IssueKind << "\n"
-            << "Location: " << Filename << ":" << Line << ":" << Col << "\n"
-            << "Message: " << Message << std::endl;
+  printf("Issue: %s\n", IssueKind);
+  printf("Location: %s:%u:%u\n", Filename, Line, Col);
+  printf("Message: %s\n", Message);
 
   (void)Addr;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49867.157535.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180726/c0a6fc2d/attachment.bin>


More information about the llvm-commits mailing list