This is an archive of the discontinued LLVM Phabricator instance.

[LIBC] Fix incorrect behavior with pthread_key_t when value was nullptr
ClosedPublic

Authored by goldstein.w.n on Apr 13 2023, 8:04 PM.

Details

Summary

We should not call destructor if value is nullptr.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Apr 13 2023, 8:04 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 13 2023, 8:04 PM
goldstein.w.n requested review of this revision.Apr 13 2023, 8:04 PM
sivachandra accepted this revision.Apr 14 2023, 12:29 PM

OK with inline comments addressed.

libc/src/__support/threads/thread.cpp
90

This is already in an anonymous namespace so static is not required.

libc/test/integration/src/pthread/pthread_tss_test.cpp
33–36

Add a comment explaining why this always failing assert is used here.

This revision is now accepted and ready to land.Apr 14 2023, 12:29 PM

Remove 'static' qualifier. Add comment.

goldstein.w.n marked 2 inline comments as done.Apr 16 2023, 5:40 PM