This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Fix behavior of realloc(nullptr, 0) on Darwin
ClosedPublic

Authored by kubamracek on Jul 26 2016, 3:55 AM.

Details

Summary

On Darwin, there are some apps that rely on realloc(nullptr, 0) returning a valid pointer. TSan currently returns nullptr in this case, let's fix it to avoid breaking binary compatibility.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 65489.Jul 26 2016, 3:55 AM
kubamracek retitled this revision from to [tsan] Fix behavior of realloc(nullptr, 0) on Darwin.
kubamracek updated this object.
kubamracek added a reviewer: dvyukov.
kubamracek added a project: Restricted Project.
kubamracek added subscribers: zaks.anna, llvm-commits.
dvyukov accepted this revision.Jul 26 2016, 5:33 AM
dvyukov edited edge metadata.

LGTM with a nit

test/tsan/Darwin/realloc-zero.cc
16 ↗(On Diff #65489)

add \n

This revision is now accepted and ready to land.Jul 26 2016, 5:33 AM
This revision was automatically updated to reflect the committed changes.

I also submitted a follow-up change to update the tsan_mman_test.cc unit test in r277463.