[PATCH] D87682: [libcxx] Disable failing test for no-exceptions build

Oliver Stannard (Linaro) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 03:44:27 PDT 2020


ostannard created this revision.
ostannard added a reviewer: ldionne.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ostannard requested review of this revision.

This test tries to create a 2 GiB std::string, catching the bad_alloc exception if the allocation fails. However, for no-exceptions builds there is no way for the error to be reported, so this crashes with a null pointer dereference.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87682

Files:
  libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp


Index: libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
===================================================================
--- libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
+++ libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
@@ -14,6 +14,7 @@
 // void pbump(int n);
 //
 // REQUIRES: long_tests
+// UNSUPPORTED: no-exceptions
 
 #include <sstream>
 #include <cassert>
@@ -28,18 +29,14 @@
 
 int main(int, char**)
 {
-#ifndef TEST_HAS_NO_EXCEPTIONS
     try {
-#endif
         std::string str(2147483648, 'a');
         SB sb;
         sb.str(str);
         assert(sb.pubpbase() <= sb.pubpptr());
-#ifndef TEST_HAS_NO_EXCEPTIONS
     }
     catch (const std::length_error &) {} // maybe the string can't take 2GB
     catch (const std::bad_alloc    &) {} // maybe we don't have enough RAM
-#endif
 
   return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87682.291860.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/b7293891/attachment.bin>


More information about the llvm-commits mailing list