Bug 2346007

Summary: GCC with LTO miscompiles KWin and breaks using ICC profiles for color management
Product: [Fedora] Fedora Reporter: Neal Gompa <ngompa13>
Component: kwinAssignee: Rex Dieter <rdieter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 42CC: aleixpol, amessina, awilliam, dmalcolm, fweimer, jakub, jgrulich, jlaw, josmyers, jwakely, kde-sig, kparal, mcermak, mpolacek, msebor, nate, nickc, nicolas.fella, nixuser, rdieter, robatino, sam, sipoyare, suraj.ghimire7, than
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: AcceptedFreezeException
Fixed In Version: kwin-6.3.2.1-1.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-03-03 23:42:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2291263, 2291264    
Attachments:
Description Flags
ICC profile that reproduces the issue none

Description Neal Gompa 2025-02-16 17:45:42 UTC
With KWin 6.3.0, it appears GCC compiling KWin with LTO miscompiles something in KWin to result in broken color management functionality. When attempting to set color profiles, the screen goes completely blank, resulting in the system being unusable.

Reproducible: Always

Steps to Reproduce:
1. In System Settings - Display Configuration, set a path to an ICC profile
2. Click Apply.

Actual Results:  
Screen goes blank and cannot recover until ICC profile setting is cleared and plasmashell is restarted.


Expected Results:  
Color profile applied and display correctly color managed

Comment 1 Neal Gompa 2025-02-16 17:48:04 UTC
Linking upstream bug report and adding several KDE folks to CC.

Comment 2 Neal Gompa 2025-02-16 17:49:45 UTC
Created attachment 2076776 [details]
ICC profile that reproduces the issue

I've attached the ICC profile from the upstream report that reproduces the issue.

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

 This GCC error results in core functionality of the compositor for the release-blocking KDE desktop to be broken.

Comment 4 Kamil Páral 2025-02-24 18:44:47 UTC
Discussed on 2025-02-24 in a blocker review meeting [1]:

!agreed 2346007 - AcceptedBetaFE AcceptedFinalBlocker - This is quite difficult to work around and a complete showstopper for a general user. Therefore it is accepted as a blocker.

[1] https://meetbot.fedoraproject.org/blocker-review_matrix_fedoraproject-org/2025-02-24/f42-blocker-review.2025-02-24-17.01.log.html

Comment 5 Dave Malcolm 2025-02-24 19:59:05 UTC
Looking at https://bugs.kde.org/show_bug.cgi?id=499789#c27 I see:

> core: Fix initialization of IccProfile::s_connectionSpace
>
> Colorimetry constants can be initialized after IccProfile::s_connectionSpace
> when LTO is enabled. It's okay with the C++ standard.
>
> As a way around it, this change moves the CIEXYZD50 constant to the
> IccProfile where it's actually needed.
>
> We need to reconsider how the constants are defined, e.g. have static
> getters or use constexpr. But as a short term solution, this should be
> fine.
>
> Co-authored-by: Xaver Hugl <xaver.hugl>
>
> M  +0    -2    src/backends/wayland/color_manager.cpp
> M  +0    -8    src/core/colorspace.cpp
> M  +0    -1    src/core/colorspace.h
> M  +8    -1    src/core/iccprofile.cpp
>
> https://invent.kde.org/plasma/kwin/-/commit/6d6667fc2a3f0a5e51676be267a5a8e1ce3c1337

I don't see any input from other GCC developers on this, but *if* I'm reading the above right, it sounds like:
(a) KWin was relying on two initializations happening in a particular order that wasn't guaranteed by the C++ standard, and which happened to stop happening with GCC with LTO, and
(b) that upstream KWin has fixed this.

If so, then it sounds like this a bug in KWin rather than in GCC.

Reassigning to kwin; please reassign back if I've misunderstood the above (which could well be the case)

Comment 6 Sam James 2025-02-24 20:05:30 UTC
Your analysis is spot on based on IRC discussion with the KWin developers at the time.

Comment 7 Sam James 2025-02-24 20:06:05 UTC
(There was/is the aliasing bug which there's a fix sitting for on a branch, I'll chase that up if they forget, but it's not relevant to this other than noticing it while investigating.)

Comment 8 Adam Williamson 2025-02-26 20:18:26 UTC
Setting POST, on the basis that there's apparently an upstream kwin commit that fixes this, which we would just need to backport?

Comment 9 Fedora Update System 2025-02-26 23:59:45 UTC
FEDORA-2025-f31d078526 (bluedevil-6.3.2-1.fc42, breeze-gtk-6.3.2-1.fc42, and 67 more) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-f31d078526

Comment 10 Fedora Update System 2025-02-28 01:08:39 UTC
FEDORA-2025-f31d078526 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-f31d078526`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-f31d078526

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

Comment 11 Kamil Páral 2025-03-03 18:30:31 UTC
Discussed on 2025-03-03 in a blocker review meeting [1]:

!info per Conan Kudo this is substantively addressed for Beta. it will either be closed, or the blocker nomination will be unset

[1] https://meetbot.fedoraproject.org/blocker-review_matrix_fedoraproject-org/2025-03-03/f42-blocker-review.2025-03-03-17.00.log.html

Comment 12 Fedora Update System 2025-03-03 23:42:03 UTC
FEDORA-2025-f31d078526 (applet-window-buttons-0.12.0^20240405.3263828-4.fc42, bluedevil-6.3.2-1.fc42, and 68 more) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Red Hat Bugzilla 2025-07-02 04:25:04 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days