Re : Re: Re : Re: qt5/qtscript crash fix
Your diff works well for me too, thanks ! Le dimanche 3 décembre 2023 à 5:19 PM, Rafael Sadowski a écrit : > > > On Sun Dec 03, 2023 at 12:33:30PM +, 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(HostCallFrameFlag); } > > int returnValueRegister() const { return > this[RegisterFile::ReturnValueRegister].i(); } > > +#pragma clang optimize off > bool hasHostCallFrameFlag() const { return reinterpret_cast(this) & > HostCallFrameFlag; } > > CallFrame* addHostCallFrameFlag() const { return > reinterpret_cast(reinterpret_cast(this) | > HostCallFrameFlag); } > > CallFrame* removeHostCallFrameFlag() { return > reinterpret_cast(reinterpret_cast(this) & > ~HostCallFrameFlag); } > > +#pragma clang optimize on > > private: > void setArgumentCount(int count) { > static_cast(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: "() at > /usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at > scripts/autostart.js:584\n() at scripts/autostart.js:859" > > Warning: At least one uncaught exception: > Warning: "() at > /usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at > scripts/autostart.js:584\n() at scripts/autostart.js:859" > > 17:15:43: Debug: "() at 151" > > > (no coredump) > > > which is funny, because now this error also appears with the "-O0" > version. I will analyze this later.
Re: Re : Re: qt5/qtscript crash fix
On Sun Dec 03, 2023 at 12:33:30PM +, 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(HostCallFrameFlag); } int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); } +#pragma clang optimize off bool hasHostCallFrameFlag() const { return reinterpret_cast(this) & HostCallFrameFlag; } CallFrame* addHostCallFrameFlag() const { return reinterpret_cast(reinterpret_cast(this) | HostCallFrameFlag); } CallFrame* removeHostCallFrameFlag() { return reinterpret_cast(reinterpret_cast(this) & ~HostCallFrameFlag); } +#pragma clang optimize on private: void setArgumentCount(int count) { static_cast(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: "() at /usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at scripts/autostart.js:584\n() at scripts/autostart.js:859" Warning: At least one uncaught exception: Warning: "() at /usr/local/share/qcad/scripts/Widgets/FirstStart/FirstStart.js:151\nmain() at scripts/autostart.js:584\n() at scripts/autostart.js:859" 17:15:43: Debug:"() at 151" (no coredump) which is funny, because now this error also appears with the "-O0" version. I will analyze this later.
Re: Re : Re: qt5/qtscript crash fix
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 -- Sent from a phone, apologies for poor formatting. On 3 December 2023 09:09:05 Jonathan Armani wrote: Le vendredi 1 décembre 2023 à 19:46, Stuart Henderson a écrit : Do you need -O0 or does -O1 also work? Yes, I tried -01 first without success. The last opt level on the command line is used, or doesn't really matter if the existing one is present when you're overriding the default. -- Sent from a phone, apologies for poor formatting. On 1 December 2023 14:26:01 Jonathan Armani jonat...@armani.tech wrote: > Hi, > > I hit an identical crash than QCAD in QT Script while playing with Mixxx. > > After trying some upstream fixes I found this solution in FreeBSD port. > Hope it will fix QCAD too, I'm not using it. > > I'm not sure this is the best way to overide with CXXFLAGS as both -O2 & -O0 > are present in the generated build command. > > Index: Makefile > === > RCS file: /cvs/ports/x11/qt5/qtscript/Makefile,v > retrieving revision 1.13 > diff -u -p -r1.13 Makefile > --- Makefile 13 Jul 2022 15:48:58 - 1.13 > +++ Makefile 30 Nov 2023 20:29:46 - > @@ -1,5 +1,9 @@ > QT5NAME = QtScript > COMMENT-main = ECMAScript language for Qt5 > +REVISION-main = 1 > + > +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265989 > +CXXFLAGS += -O0 > > MULTI_PACKAGES = -main -examples > SHARED_LIBS += Qt5Script 3.0 # 5.9
Re : Re: qt5/qtscript crash fix
Le vendredi 1 décembre 2023 à 19:46, Stuart Henderson a écrit : > > > Do you need -O0 or does -O1 also work? Yes, I tried -01 first without success. > > The last opt level on the command line is used, or doesn't really matter if > the existing one is present when you're overriding the default. > > -- > Sent from a phone, apologies for poor formatting. > > On 1 December 2023 14:26:01 Jonathan Armani jonat...@armani.tech wrote: > > > Hi, > > > > I hit an identical crash than QCAD in QT Script while playing with Mixxx. > > > > After trying some upstream fixes I found this solution in FreeBSD port. > > Hope it will fix QCAD too, I'm not using it. > > > > I'm not sure this is the best way to overide with CXXFLAGS as both -O2 & -O0 > > are present in the generated build command. > > > > Index: Makefile > > === > > RCS file: /cvs/ports/x11/qt5/qtscript/Makefile,v > > retrieving revision 1.13 > > diff -u -p -r1.13 Makefile > > --- Makefile 13 Jul 2022 15:48:58 - 1.13 > > +++ Makefile 30 Nov 2023 20:29:46 - > > @@ -1,5 +1,9 @@ > > QT5NAME = QtScript > > COMMENT-main = ECMAScript language for Qt5 > > +REVISION-main = 1 > > + > > +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265989 > > +CXXFLAGS += -O0 > > > > MULTI_PACKAGES = -main -examples > > SHARED_LIBS += Qt5Script 3.0 # 5.9
Re: qt5/qtscript crash fix
On Fri Dec 01, 2023 at 06:46:48PM +, Stuart Henderson wrote: > Do you need -O0 or does -O1 also work? Unfortunately no. I can confirm only -O0 helps here. If no objection I'll commit with the REVISION bump. > > The last opt level on the command line is used, or doesn't really matter if > the existing one is present when you're overriding the default. > > -- > Sent from a phone, apologies for poor formatting. > > On 1 December 2023 14:26:01 Jonathan Armani wrote: > > > Hi, > > > > I hit an identical crash than QCAD in QT Script while playing with Mixxx. > > > > After trying some upstream fixes I found this solution in FreeBSD port. > > Hope it will fix QCAD too, I'm not using it. > > > > I'm not sure this is the best way to overide with CXXFLAGS as both -O2 & -O0 > > are present in the generated build command. Thank you, Jonathan, for finding this long-standing issue. In FreeBSD this must have been broken a long time ago too. > > > > Index: Makefile > > === > > RCS file: /cvs/ports/x11/qt5/qtscript/Makefile,v > > retrieving revision 1.13 > > diff -u -p -r1.13 Makefile > > --- Makefile 13 Jul 2022 15:48:58 - 1.13 > > +++ Makefile 30 Nov 2023 20:29:46 - > > @@ -1,5 +1,9 @@ > > QT5NAME = QtScript > > COMMENT-main = ECMAScript language for Qt5 > > +REVISION-main = 1 > > + > > +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265989 > > +CXXFLAGS += -O0 > > > > MULTI_PACKAGES = -main -examples > > SHARED_LIBS += Qt5Script 3.0 # 5.9 >
Re: qt5/qtscript crash fix
Do you need -O0 or does -O1 also work? The last opt level on the command line is used, or doesn't really matter if the existing one is present when you're overriding the default. -- Sent from a phone, apologies for poor formatting. On 1 December 2023 14:26:01 Jonathan Armani wrote: Hi, I hit an identical crash than QCAD in QT Script while playing with Mixxx. After trying some upstream fixes I found this solution in FreeBSD port. Hope it will fix QCAD too, I'm not using it. I'm not sure this is the best way to overide with CXXFLAGS as both -O2 & -O0 are present in the generated build command. Index: Makefile === RCS file: /cvs/ports/x11/qt5/qtscript/Makefile,v retrieving revision 1.13 diff -u -p -r1.13 Makefile --- Makefile 13 Jul 2022 15:48:58 - 1.13 +++ Makefile 30 Nov 2023 20:29:46 - @@ -1,5 +1,9 @@ QT5NAME = QtScript COMMENT-main = ECMAScript language for Qt5 +REVISION-main = 1 + +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265989 +CXXFLAGS += -O0 MULTI_PACKAGES = -main -examples SHARED_LIBS += Qt5Script 3.0 # 5.9
qt5/qtscript crash fix
Hi, I hit an identical crash than QCAD in QT Script while playing with Mixxx. After trying some upstream fixes I found this solution in FreeBSD port. Hope it will fix QCAD too, I'm not using it. I'm not sure this is the best way to overide with CXXFLAGS as both -O2 & -O0 are present in the generated build command. Index: Makefile === RCS file: /cvs/ports/x11/qt5/qtscript/Makefile,v retrieving revision 1.13 diff -u -p -r1.13 Makefile --- Makefile13 Jul 2022 15:48:58 - 1.13 +++ Makefile30 Nov 2023 20:29:46 - @@ -1,5 +1,9 @@ QT5NAME = QtScript COMMENT-main = ECMAScript language for Qt5 +REVISION-main =1 + +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265989 +CXXFLAGS +=-O0 MULTI_PACKAGES = -main -examples SHARED_LIBS += Qt5Script 3.0 # 5.9