Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 933603

Summary: kde-apps/libkgapi-23.08.5-r1 test fail SEGFAULT when LTO is enabled(NO LTO warning!!!)
Product: Gentoo Linux Reporter: Arniii <lg3dx6fd>
Component: Current packagesAssignee: Gentoo KDE team <kde>
Status: UNCONFIRMED ---    
Severity: normal CC: lg3dx6fd
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: libkgapi_build.log.lz
environment // profile default/linux/amd64/17.1/desktop/plasma gcc-13 O3 pipe march=native(verbose) lto graphite ggdb3
/var/tmp/portage/kde-apps/libkgapi-23.08.5-r1/work/libkgapi-23.08.5_build/Testing/Temporary/LastTest.log
my attempts to backtrace

Description Arniii 2024-06-05 10:39:31 UTC
from build log:
```
The following tests FAILED:
         22 - drive-aboutfetchjobtest (SEGFAULT)
         23 - drive-changefetchjobtest (SEGFAULT)
         24 - drive-filecopyjobtest (SEGFAULT)
         25 - drive-filecreatejobtest (SEGFAULT)
         26 - drive-filesearchquerytest (SEGFAULT)
         27 - drive-drivescreatejobtest (SEGFAULT)
         28 - drive-drivesdeletejobtest (SEGFAULT)
         29 - drive-drivesmodifyjobtest (SEGFAULT)
         30 - drive-driveshidejobtest (SEGFAULT)
         31 - drive-drivesfetchjobtest (SEGFAULT)
         32 - drive-drivessearchquerytest (SEGFAULT)
         33 - drive-teamdrivecreatejobtest (SEGFAULT)
         34 - drive-teamdrivedeletejobtest (SEGFAULT)
         35 - drive-teamdrivemodifyjobtest (SEGFAULT)
         36 - drive-teamdrivefetchjobtest (SEGFAULT)
         37 - drive-teamdrivesearchquerytest (SEGFAULT)
Errors while running CTest
Output from these tests are in: /var/tmp/portage/kde-apps/libkgapi-23.08.5-r1/work/libkgapi-23.08.5_build/Testing/Temporary/LastTest.log
```
Comment 1 Arniii 2024-06-05 10:41:10 UTC
Created attachment 895150 [details]
libkgapi_build.log.lz
Comment 2 Arniii 2024-06-05 10:41:52 UTC
Created attachment 895151 [details]
environment // profile default/linux/amd64/17.1/desktop/plasma gcc-13 O3 pipe march=native(verbose) lto graphite ggdb3
Comment 3 Arniii 2024-06-05 10:42:20 UTC
Created attachment 895152 [details]
/var/tmp/portage/kde-apps/libkgapi-23.08.5-r1/work/libkgapi-23.08.5_build/Testing/Temporary/LastTest.log
Comment 4 Arniii 2024-06-05 10:44:04 UTC
Created attachment 895153 [details]
my attempts to backtrace

usually backtrace looks like this: 
```
(gdb) bt
#0  QtPrivate::RefCount::ref (this=0x0) at /usr/include/qt5/QtCore/qrefcount.h:55
#1  0x00007ffff7f55b18 in _sub_I_65535_0.0 () from /var/tmp/portage/kde-apps/libkgapi-23.08.5-r1/work/libkgapi-23.08.5_build/bin/libKPim5GAPIDrive.so.5
#2  0x00007ffff7fcd5ee in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffdb38, env=env@entry=0x7fffffffdb48) at dl-init.c:74
#3  0x00007ffff7fcd6db in call_init (env=0x7fffffffdb48, argv=0x7fffffffdb38, argc=1, l=<optimized out>) at dl-init.c:120
#4  _dl_init (main_map=0x7ffff7ffe2e0, argc=1, argv=0x7fffffffdb38, env=0x7fffffffdb48) at dl-init.c:121
#5  0x00007ffff7fe5020 in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffdf5c in ?? ()
#8  0x0000000000000000 in ?? ()
```
Comment 5 Andreas Sturmlechner gentoo-dev 2024-06-06 20:29:35 UTC
Reproducibly without lto or graphite...?
Comment 6 Arniii 2024-06-06 21:20:20 UTC
iteration 1:  IT HAPPENS when -O0 -march=native(verbosely) LTO graphite ggdb3 -frecord-gcc-switches(gentoo testing related)
```
  MARCH_NATIVE_GCC="-march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=30720"

  LTO_WARNINGS_GCC="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
  LTO_FLAGS_GCC="-flto ${LTO_WARNINGS_GCC}"

  GCC_POLLY="-fgraphite-identity -floop-interchange -floop-strip-mine -floop-nest-optimize"

  DEBUG_FLAGS_GCC="-ggdb3"

  BECAUSE_PACKAGE_TESTING_WIKI_CF="-frecord-gcc-switches"
  BECAUSE_PACKAGE_TESTING_WIKI_LDF="-Wl,--defsym=__gentoo_check_ldflags__=0"

  COMMON_FLAGS="-O0 -pipe ${MARCH_NATIVE_GCC} ${GCC_POLLY} ${LTO_FLAGS_GCC} ${DEBUG_FLAGS_GCC} ${BECAUSE_PACKAGE_TESTING_WIKI_CF}"
  CFLAGS="${COMMON_FLAGS}"
  CXXFLAGS="${COMMON_FLAGS}"
  FCFLAGS="${COMMON_FLAGS}"
  FFLAGS="${COMMON_FLAGS}"

  LDFLAGS="${LDFLAGS} ${BECAUSE_PACKAGE_TESTING_WIKI_LDF}"
```
Comment 7 Arniii 2024-06-06 21:38:33 UTC
iteration 2: it doesn't happen when only -O0 -pipe -ggdb3 -frecord-gcc-switches
Comment 8 Arniii 2024-06-06 21:48:03 UTC
iteration 3: it doesn't happen when -O0 -ggdb3 -pipe + graphite_flags + -frecord-gcc-switches

```
  GCC_POLLY="-fgraphite-identity -floop-interchange -floop-strip-mine -floop-nest-optimize"

  DEBUG_FLAGS_GCC="-ggdb3"

  BECAUSE_PACKAGE_TESTING_WIKI_CF="-frecord-gcc-switches"
  BECAUSE_PACKAGE_TESTING_WIKI_LDF="-Wl,--defsym=__gentoo_check_ldflags__=0"

  COMMON_FLAGS="-O0 -pipe ${DEBUG_FLAGS_GCC} ${GCC_POLLY} ${BECAUSE_PACKAGE_TESTING_WIKI_CF}"
  CFLAGS="${COMMON_FLAGS}"
  CXXFLAGS="${COMMON_FLAGS}"
  FCFLAGS="${COMMON_FLAGS}"
  FFLAGS="${COMMON_FLAGS}"

  LDFLAGS="${LDFLAGS} ${BECAUSE_PACKAGE_TESTING_WIKI_LDF}"
```
Comment 9 Arniii 2024-06-06 21:59:22 UTC
Iteration 4: IT HAPPENS when (iteration 3 + LTO)
```
  LTO_WARNINGS_GCC="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
  LTO_FLAGS_GCC="-flto ${LTO_WARNINGS_GCC}"

  GCC_POLLY="-fgraphite-identity -floop-interchange -floop-strip-mine -floop-nest-optimize"

  DEBUG_FLAGS_GCC="-ggdb3"

  BECAUSE_PACKAGE_TESTING_WIKI_CF="-frecord-gcc-switches"
  BECAUSE_PACKAGE_TESTING_WIKI_LDF="-Wl,--defsym=__gentoo_check_ldflags__=0"

  COMMON_FLAGS="-O0 -pipe ${DEBUG_FLAGS_GCC} ${GCC_POLLY} ${LTO_FLAGS_GCC} ${BECAUSE_PACKAGE_TESTING_WIKI_CF}"
  CFLAGS="${COMMON_FLAGS}"
  CXXFLAGS="${COMMON_FLAGS}"
  FCFLAGS="${COMMON_FLAGS}"
  FFLAGS="${COMMON_FLAGS}"

  LDFLAGS="${LDFLAGS} ${BECAUSE_PACKAGE_TESTING_WIKI_LDF}"


```
Comment 10 Arniii 2024-06-06 22:02:13 UTC
Iteration 5: IT HAPPENS when (iteration 2 + LTO)
```
  LTO_WARNINGS_GCC="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
  LTO_FLAGS_GCC="-flto ${LTO_WARNINGS_GCC}"

  DEBUG_FLAGS_GCC="-ggdb3"

  BECAUSE_PACKAGE_TESTING_WIKI_CF="-frecord-gcc-switches"
  BECAUSE_PACKAGE_TESTING_WIKI_LDF="-Wl,--defsym=__gentoo_check_ldflags__=0"

  COMMON_FLAGS="-O0 -pipe ${DEBUG_FLAGS_GCC} ${LTO_FLAGS_GCC} ${BECAUSE_PACKAGE_TESTING_WIKI_CF}"
  CFLAGS="${COMMON_FLAGS}"
  CXXFLAGS="${COMMON_FLAGS}"
  FCFLAGS="${COMMON_FLAGS}"
  FFLAGS="${COMMON_FLAGS}"

  LDFLAGS="${LDFLAGS} ${BECAUSE_PACKAGE_TESTING_WIKI_LDF}"

```
Comment 11 Arniii 2024-06-06 22:03:06 UTC
I assume it happens when LTO is enabled.

Though LTO-related warnings are not triggered, that's interesting.
Comment 12 Arniii 2024-06-06 22:09:11 UTC
iteration 6: it doesn't happen when used my usual flags (-O3 -march=native(verbose) -ggdb3 +graphite +testing_related +lto ) with no LTO .