Skip to content

Commit 5cefa3b

Browse files
authored
Merge pull request #10457 from kubamracek/4.0-runtime-reporting-fix-asm
[4.0] Prevent _swift_runtime_on_report from having its arguments optimized out.
2 parents b4731f8 + 9b4898f commit 5cefa3b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/runtime/Errors.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ void _swift_runtime_on_report(bool isFatal, const char *message,
245245
// Do nothing. This function is meant to be used by the debugger.
246246

247247
// The following is necessary to avoid calls from being optimized out.
248-
asm volatile("" ::: "memory");
248+
asm volatile("" // Do nothing.
249+
: // Output list, empty.
250+
: "r" (isFatal), "r" (message), "r" (details) // Input list.
251+
: // Clobber list, empty.
252+
);
249253
}
250254

251255
void swift::reportToDebugger(bool isFatal, const char *message,

0 commit comments

Comments
 (0)