Bug 2342065 - Broken support for C++ coroutines in GCC 15 breaks qcoro, which breaks Plasma Discover [NEEDINFO]
Summary: Broken support for C++ coroutines in GCC 15 breaks qcoro, which breaks Plasma...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 42
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: AcceptedBlocker
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-01-25 12:13 UTC by Steve Cossette
Modified: 2025-03-10 20:19 UTC (History)
26 users (show)

Fixed In Version: gcc-15.0.1-0.9.fc42
Clone Of:
Environment:
Last Closed: 2025-03-10 16:13:45 UTC
Type: Bug
Embargoed:
awilliam: needinfo? (jakub)


Attachments (Terms of Use)
Stacktrace (180.63 KB, text/plain)
2025-01-25 12:13 UTC, Steve Cossette
no flags Details
minimal reproducer (1.38 KB, text/x-csrc)
2025-02-09 14:07 UTC, Alessandro Astone
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 116506 0 P1 ASSIGNED [15 Regression] Destructors of temporary awaitables are executed too early 2025-01-31 21:57:55 UTC
Github qcoro qcoro issues 262 0 None open Qcoro tests fail on GCC 15 2025-01-31 21:57:55 UTC
KDE Software Compilation 499100 0 NOR UNCONFIRMED Discover crash on start 2025-01-25 12:13:11 UTC

Description Steve Cossette 2025-01-25 12:13:11 UTC
Created attachment 2073764 [details]
Stacktrace

Built version of plasma-discover 6.2.91 fails to start. A compiler bug is suspected.

https://bodhi.fedoraproject.org/updates/FEDORA-2025-c1d22427c2

Comment 1 Steve Cossette 2025-01-25 13:44:42 UTC
Installing the update on Fedora 41 results in a functional discover. So I would say this being a GCC issue is very likely.

Comment 2 Neal Gompa 2025-01-25 13:46:52 UTC
Notably meaning that installing Plasma 6.2.91 (Plasma 6.3 beta 2) from this COPR for F41 works: https://copr.fedorainfracloud.org/coprs/farchord/kde-test/builds/

Comment 3 Fedora Blocker Bugs Application 2025-01-25 13:49:16 UTC
Proposed as a Blocker for 42-beta by Fedora user ngompa using the blocker tracking app because:

 This violates the criteria for "Installing, removing and updating software" as the default expected software management tool crashing on start prevents users from being able to manage the software of the system.

Comment 4 Jakub Jelinek 2025-01-27 10:12:00 UTC
GCC 15 implements newly the https://wg21.link/p2718r0 paper (see https://gcc.gnu.org/r15-3840 and https://gcc.gnu.org/PR107637 for more details).
Unfortunately, it seems it interacts badly with coroutines (co_await/co_yield/co_return in the body of such range for loops) and that is
still unfixed.
See https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=115851%2C%20116506%2C%20116880%2C%20116914%2C%20117231%2C%20117364%2C%20118470%2C%20118491%2C%20118574&list_id=461391
for the currently pending coroutines bugs, several of them are perhaps dups.
While I've included a preliminary patch for one of these issues in gcc src.rpm, clearly that is not enough.
What -std= is KDE using?
In -std=c++23 / -std=gnu++23 / -std=c++26 / -std=gnu++26 is P2118R0 required and can't be disabled, but in
-std=gnu++11 / -std=gnu++14 / -std=gnu++17 / -std=gnu++20 is the extending of range for loop temporaries across the body enabled as an extension.
If you use those (note -std=gnu++17 is the default when not using any -std= options), perhaps you could try
to add -fno-range-for-ext-temps option as a temporary workaround.

Comment 5 Steve Cossette 2025-01-27 11:22:40 UTC
The fact that plasma-discover doesn't start might actually have something to do with qcoro, which gcc is also suspected here. qcoro6 is a build dependancy for plasma-discover, and it's tests fail when building it on gcc15. A ticket is open here: https://github.com/qcoro/qcoro/issues/262#issuecomment-2614612670

Comment 6 Steve Cossette 2025-01-27 18:19:19 UTC
Yeah I'm not sure about the standard we use, but according to the qcoro dev (Which plasma requires) they say this regression is the reason for the tests failing: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116506

Comment 7 Neal Gompa 2025-01-27 19:18:25 UTC
KDE software is generally built with C++20.

Plasma Discover is no exception: https://invent.kde.org/plasma/discover/-/blob/master/CMakeLists.txt?ref_type=heads#L11

Comment 8 Neal Gompa 2025-01-27 19:19:26 UTC
CMake translates this to gnu++20 for GCC.

Comment 9 Neal Gompa 2025-01-31 21:57:55 UTC
At this point, we're reasonably certain that this is a GCC bug with C++ coroutines, so I'm reassigning this bug to gcc.

I've also added references to other related bug reports.

Comment 10 Alessandro Astone 2025-02-09 11:06:32 UTC
@jakub: 15.0.1-0.7 seems to have helped a bit, for instance the QCoro tests are now passing, but plasma-discover still crashes in a coroutine:
https://bugs.kde.org/show_bug.cgi?id=499704
https://invent.kde.org/plasma/discover/-/blob/79483536f8d412dd239e39dac70dfd4a14625ade/libdiscover/appstream/AppStreamUtils.cpp#L196

Comment 11 Alessandro Astone 2025-02-09 13:46:50 UTC
My minimal reproducer with Qt6 and QCoro6:

```
#include <QCoreApplication>
#include <QCoroTask>
#include <QCoroTimer>

using namespace std::chrono_literals;

QCoro::Task<QString> processStringList() {
    QStringList ret;
    for (const auto &item: QStringList{
            QLatin1String{"foo"},
            QLatin1String{"bar"}}) {
        QTimer timer;
        timer.start(200ms);
        co_await timer;

        ret += item;
    }
    co_return ret.join(", ");
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QObject o;
    QCoro::connect(processStringList(), &o, [&a](auto &&res) {
        qInfo() << res;
        a.quit();
    });

    return a.exec();
}
```

Compiler command-line:
g++ -I/usr/include/qt6/QtCore -I/usr/include/qt6 -I/usr/lib64/qt6/mkspecs/linux-g++ -I/usr/include/qcoro6/qcoro -I/usr/include/qcoro6/QCoro -std=gnu++20 -fcoroutines main.cpp -lQt6Core -lQCoro6Core

It only crashes when compiled with -std=gnu++20, while it works fine when compiled with -std=c++20

Comment 12 Alessandro Astone 2025-02-09 14:07:12 UTC
Created attachment 2075767 [details]
minimal reproducer

And here's a minimal reproducer which does not Qt.
Crashes the same way, destructing the std::vector

Comment 13 Jakub Jelinek 2025-02-10 11:01:10 UTC
Thanks, reduced to just <coroutine> and no other headers in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118574#c12

Comment 14 Adam Williamson 2025-02-10 16:07:44 UTC
+3 in https://pagure.io/fedora-qa/blocker-review/issue/1747 , marked accepted blocker.

Comment 15 Adam Williamson 2025-02-15 17:23:28 UTC
Looks like this is fixed upstream in https://gcc.gnu.org/g:a1855a3e0bcf0f94bc9fa421ccc9ebd0565c62cd ?

Comment 16 Adam Williamson 2025-02-18 16:28:47 UTC
Jakub, could we have a build with the fix for this? It is a Fedora 42 Beta blocker and we're entering Beta freeze, so we'd like to get blockers addressed and build Beta candidates ASAP. Thanks!

Comment 17 Neal Gompa 2025-02-22 22:40:05 UTC
This is still breaking things. We're seeing the same problems with plasma-nm that we saw with Discover.

Comment 18 Fedora Update System 2025-02-23 13:08:27 UTC
FEDORA-2025-8451591d04 (plasma-nm-6.3.1-2.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-8451591d04

Comment 19 Neal Gompa 2025-02-23 13:58:21 UTC
Still not fixed.

Comment 20 Fedora Update System 2025-02-23 14:26:48 UTC
FEDORA-2025-8451591d04 (plasma-nm-6.3.1-2.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 21 Steve Cossette 2025-02-23 14:37:01 UTC
Reopening

Comment 22 Steve Cossette 2025-02-23 14:38:01 UTC
We have pushed out mitigations to this problem, but the underlying issue still remains.

Comment 23 Fedora Update System 2025-02-26 12:22:49 UTC
FEDORA-2025-3659245be1 (gcc-15.0.1-0.8.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3659245be1

Comment 24 Aoife Moloney 2025-02-26 13:48:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 25 Fedora Update System 2025-02-27 02:11:25 UTC
FEDORA-2025-3659245be1 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-3659245be1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-3659245be1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 26 Fedora Update System 2025-03-04 01:43:43 UTC
FEDORA-2025-6a12d86df4 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-6a12d86df4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-6a12d86df4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 27 Fedora Update System 2025-03-10 16:13:45 UTC
FEDORA-2025-6a12d86df4 (gcc-15.0.1-0.9.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 28 Steve Cossette 2025-03-10 17:42:29 UTC
Leaving this open in case it's still needed, and it does need testing.

Comment 29 Kamil Páral 2025-03-10 20:19:10 UTC
According to Neal, the current workarounds in Plasma should be good enough for the Beta release. And now that gcc is stable, qcoro and plasma can be rebuilt without the workarounds. I don't know if you want to keep the bug open, but I'm lifting the blocker tag, because it should be resolved in terms of a blocker bug process.


Note You need to log in before you can comment on or make changes to this bug.