Bug 480522

Summary: kdeconnect plasmoid fails to compile with LTO enabled
Product: [Applications] kdeconnect Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: plasmoidAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal CC: sam
Priority: NOR    
Version: 23.08.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Erik Quaeghebeur 2024-01-30 07:08:59 UTC
SUMMARY
kdeconnect does not compile with LTO enabled [lto-type-mismatch warnings as errors]:

---
/var/tmp/portage/kde-misc/kdeconnect-23.08.4/work/kdeconnect-kde-23.08.4/smsapp/gsmasciimap.h:10:13: error: type of ‘gsm_ascii_map’ does not match original declaration [-Werror=lto-type-mismatch]                                         
   10 | extern bool gsm_ascii_map[128];                                                                                                                                                                                                     
      |             ^                                                                                                                                                                                                                       
/var/tmp/portage/kde-misc/kdeconnect-23.08.4/work/kdeconnect-kde-23.08.4/smsapp/gsmasciimap.cpp:12:6: note: array types have different bounds                                                                                               
   12 | bool gsm_ascii_map[] = {                                                                                                                                                                                                            
      |      ^                                                                                                                                                                                                                              
/var/tmp/portage/kde-misc/kdeconnect-23.08.4/work/kdeconnect-kde-23.08.4/smsapp/gsmasciimap.cpp:12:6: note: ‘gsm_ascii_map’ was previously declared here                                                                                    
lto1: some warnings being treated as errors                                                                                                                                                                                                 
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status                                                                                                                                                           
compilation terminated.                   
---

STEPS TO REPRODUCE
1. compile with LTO enabled and warnings that indicate LTO-unsafe constructs promoted to errors (see at end of report)

OBSERVED RESULT
Compile fails

EXPECTED RESULT
Compile succeeds

SOFTWARE/OS VERSIONS
GCC: 13.2.1_p20240113
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.12

ADDITIONAL INFORMATION
Downstream bug report: https://bugs.gentoo.org/921648

GCC flags used:
WARNING_FLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
COMMON_FLAGS="-march=native -O2 -pipe -flto=auto ${WARNING_FLAGS}"