devel/qt5-script: Prevent clang from optimizing the code with undefined behavior

PR:		277236
Obtained from:	OpenBSD ports
This commit is contained in:
Tomas Tevesz 2024-03-23 00:16:49 +03:00 committed by Gleb Popov
parent 860821402c
commit 9e3ff8f0b9
2 changed files with 16 additions and 1 deletions

View file

@ -1,6 +1,6 @@
PORTNAME= script
PORTVERSION= ${QT5_VERSION}${QT5_KDE_PATCH}
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel
PKGNAMEPREFIX= qt5-

View file

@ -0,0 +1,15 @@
Index: src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h
--- src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h.orig
+++ src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h
@@ -135,9 +135,11 @@ namespace JSC {
static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
+#pragma clang optimize off
bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
+#pragma clang optimize on
private:
void setArgumentCount(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }