On Sun Dec 03, 2023 at 12:33:30PM +0000, Stuart Henderson wrote:
> Could it be this?
>
> https://bugreports.qt.io/plugins/servlet/mobile#issue/QBS-1684/comment/640130
>
> Franz Jung
> Added 26 Jan '23 09:38
>
> Clang >= 13
> Opitmizes the JSC::ExecState::removeHostCallFrameFlag and
> JSC::ExecState::hasHostCallFrameFlag calls away (file
> qtscript/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h)
> Thats the reason why an 0x1 pointer instead of an nullptr gets propagated
> around.
>
> so if you change these to static member funtctions instead of non-static to
> remove/check for HostCallFrame it should work.
>
> see https://github.com/llvm/llvm-project/issues/60294
>
Interesting. When I use static I ran in other compile issues with auto_ptr.
So I tried:
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); }
This patch above compiles and qcad starts with an dialog but then an
error message appears:
QCAD version 3.27.9
17:15:40: Debug: loading plugins...
17:15:40: Debug: loading static plugins...
Warning: Qt WebEngine seems to be initialized from a plugin. Please set
Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before
constructing QGuiApplication.
17:15:41: Debug: Renaming old unversioned config file from
'/home/rsadowski/.config/QCAD/QCAD3.conf' to
'/home/rsadowski/.config/QCAD/QCAD3_old.conf'
Warning: RScriptHandlerEcma::eval: script engine exception: "TypeError:
Result of expression 'paperSize.width' [undefined] is not a function."
Warning: "<anonymous>() at
/usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at
scripts/autostart.js:584\n<global>() at scripts/autostart.js:859"
Warning: At least one uncaught exception:
Warning: "<anonymous>() at
/usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at
scripts/autostart.js:584\n<global>() at scripts/autostart.js:859"
17:15:43: Debug: "<global>() at 151"
(no coredump)
which is funny, because now this error also appears with the "-O0"
version. I will analyze this later.