Skip to content

Commit 69b4ea3

Browse files
authored
Merge pull request #80421 from swiftlang/revert-80246-playing-with-pointy-pointers
Revert "Concurrency: remove workaround for silencing UB"
2 parents cac0abb + 240a43b commit 69b4ea3

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "swift/Runtime/EnvironmentVariables.h"
3636
#include "swift/Runtime/HeapObject.h"
3737
#include "swift/Runtime/Heap.h"
38-
#include "swift/Runtime/STLCompatibility.h"
3938
#include "swift/Threading/Mutex.h"
4039
#include <atomic>
4140
#include <new>
@@ -1059,6 +1058,8 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
10591058
// Initialize the parent context pointer to null.
10601059
initialContext->Parent = nullptr;
10611060

1061+
#pragma clang diagnostic push
1062+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
10621063
// Initialize the resumption funclet pointer (async return address) to
10631064
// the final funclet for completing the task.
10641065

@@ -1072,20 +1073,21 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
10721073
// The final funclet shouldn't release the task or the task function.
10731074
} else if (asyncLet) {
10741075
initialContext->ResumeParent =
1075-
std::bit_cast<TaskContinuationFunction *>(&completeTask);
1076+
reinterpret_cast<TaskContinuationFunction*>(&completeTask);
10761077

10771078
// If we have a non-null closure context and the task function is not
10781079
// consumed by calling it, use a final funclet that releases both the
10791080
// task and the closure context.
10801081
} else if (closureContext && !taskCreateFlags.isTaskFunctionConsumed()) {
10811082
initialContext->ResumeParent =
1082-
std::bit_cast<TaskContinuationFunction *>(&completeTaskWithClosure);
1083+
reinterpret_cast<TaskContinuationFunction*>(&completeTaskWithClosure);
10831084

10841085
// Otherwise, just release the task.
10851086
} else {
10861087
initialContext->ResumeParent =
1087-
std::bit_cast<TaskContinuationFunction *>(&completeTaskAndRelease);
1088+
reinterpret_cast<TaskContinuationFunction*>(&completeTaskAndRelease);
10881089
}
1090+
#pragma clang diagnostic pop
10891091

10901092
// Initialize the task-local allocator and our other private runtime
10911093
// state for the task.

test/embedded/dependencies-concurrency-custom-executor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
// DEP: _exit
1919
// DEP: _free
2020
// DEP: _malloc
21-
// DEP: _memcpy
2221
// DEP: _memmove
2322
// DEP: _memset
2423
// DEP: _memset_s

test/embedded/dependencies-concurrency.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
// DEP: _exit
1919
// DEP: _free
2020
// DEP: _malloc
21-
// DEP: _memcpy
2221
// DEP: _memmove
2322
// DEP: _memset
2423
// DEP: _memset_s

test/embedded/dependencies-concurrency2.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// DEP: _exit
1717
// DEP: _free
1818
// DEP: _malloc
19-
// DEP: _memcpy
2019
// DEP: _memmove
2120
// DEP: _memset
2221
// DEP: _memset_s

0 commit comments

Comments
 (0)