[PATCH] D35690: [Sanitizers] TSan allocator set errno on failure.

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 22:41:59 PDT 2017


dvyukov added inline comments.


================
Comment at: lib/tsan/tests/unit/tsan_mman_test.cc:72
     void *p2 = user_realloc(thr, pc, p, 0);
-    EXPECT_NE(p2, (void*)0);
+    EXPECT_EQ(p2, (void*)0);
   }
----------------
dvyukov wrote:
> Is there a particular reason for this change? If not, then I would prefer to leave the current behavior. It worked for 5 years. We don't know what will happen with this one.
Note: the current behavior is correct according to both POSIX, linux man pages and C: 

If size is 0, either a null pointer or a unique pointer that can be successfully passed to free() shall be returned.

If size was equal to 0, either NULL or a pointer suitable to be passed to free() is returned.


https://reviews.llvm.org/D35690





More information about the llvm-commits mailing list