danvratil / qcoro

C++ Coroutines for Qt
https://qcoro.dvratil.cz
MIT License
326 stars 53 forks source link

Apple Clang ICEs in Release build of QCoro #186

Open danvratil opened 1 year ago

danvratil commented 1 year ago

Discovered when submitting QCoro to vcpkg - the CI was failing for OSX due to ICE. Below is the relevant excerpt from the build log.

I think we should be able to reproduce this in our CI as well, we just need to do a Release build instead of RelWithDebInfo/Debug builds.

[36/90] /Library/Developer/CommandLineTools/usr/bin/c++ -DQT_CORE_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_FOREACH -DQT_NO_KEYWORDS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_STRINGBUILDER -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro/core/QCoro5Core_autogen/include -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro/core -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro/core -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro -isystem /Users/vagrant/Data/installed/x64-osx/include/qt5 -isystem /Users/vagrant/Data/installed/x64-osx/include/qt5/QtCore -isystem /Users/vagrant/Data/installed/x64-osx/tools/qt5/mkspecs/macx-clang -fPIC -fcoroutines-ts -O3 -DNDEBUG -std=gnu++20 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -fPIC -MD -MT qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o -MF qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o.d -o qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o -c /Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro/core/qcorotimer.cpp
FAILED: qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DQT_CORE_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_FOREACH -DQT_NO_KEYWORDS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_STRINGBUILDER -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro/core/QCoro5Core_autogen/include -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro -I/Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro/core -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro/core -I/Users/vagrant/Data/buildtrees/qcoro-qt5/x64-osx-rel/qcoro -isystem /Users/vagrant/Data/installed/x64-osx/include/qt5 -isystem /Users/vagrant/Data/installed/x64-osx/include/qt5/QtCore -isystem /Users/vagrant/Data/installed/x64-osx/tools/qt5/mkspecs/macx-clang -fPIC -fcoroutines-ts -O3 -DNDEBUG -std=gnu++20 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -fPIC -MD -MT qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o -MF qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o.d -o qcoro/core/CMakeFiles/QCoro5Core.dir/qcorotimer.cpp.o -c /Users/vagrant/Data/buildtrees/qcoro-qt5/src/v0.9.0-0c4ecd88dc.clean/qcoro/core/qcorotimer.cpp
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/wx/y4hpq11d2m93c6gy8778wnmc0000gn/T/qcorotimer-cf9282.cpp
clang: note: diagnostic msg: /var/folders/wx/y4hpq11d2m93c6gy8778wnmc0000gn/T/qcorotimer-cf9282.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/vagrant/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg: 

********************
rgriebl commented 8 months ago

Just encountered this as well: On Github CI runners, this can be reproduced with the macos-11 runners, which run XCode 13.2.1. Clang doesn't crash on the macos-12 and macos-13 runners, which have XCode 14.2 and 14.3.1 respectively.

FYI if anybody is googling for this: the most obvious solution ("use a macos-12 runner") doesn't work when building against Qt 6.5.3, 6.6.0 or 6.6.1 in C++20 mode, because they all have this bug: https://bugreports.qt.io/browse/QTBUG-117765