Bug 1988155

Summary: libomp fails to build with lto enabled
Product: [Fedora] Fedora Reporter: Tom Stellard <tstellar>
Component: libompAssignee: Tom Stellard <tstellar>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: jchecahi, kkleine, npopov, sguelton, tstellar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-12 16:12:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tom Stellard 2021-07-29 21:42:28 UTC
libomp-12.0.1 fails to build with lto.  Here is the error:



 2524 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2524:32: note: a different type is defined in another translation unit
 2524 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2558:26: note: the first difference of corresponding definitions is field ‘th_def_allocator’
 2558 |   omp_allocator_handle_t th_def_allocator; /* default allocator */
      |                          ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2558:26: note: a field of same name but different type is defined in another translation unit
 2558 |   omp_allocator_handle_t th_def_allocator; /* default allocator */
      |                          ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2524:32: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
 2524 | typedef struct KMP_ALIGN_CACHE kmp_base_info {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2664:31: warning: type ‘union kmp_info’ violates the C++ One Definition Rule [-Wodr]
 2664 | typedef union KMP_ALIGN_CACHE kmp_info {
      |                               ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2664:31: note: a different type is defined in another translation unit
 2664 | typedef union KMP_ALIGN_CACHE kmp_info {
      |                               ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2667:19: note: the first difference of corresponding definitions is field ‘th’
 2667 |   kmp_base_info_t th;
      |                   ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2667:19: note: a field of same name but different type is defined in another translation unit
 2667 |   kmp_base_info_t th;
      |                   ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2664:31: note: type ‘struct kmp_base_info_t’ itself violates the C++ One Definition Rule
 2664 | typedef union KMP_ALIGN_CACHE kmp_info {
      |                               ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2707:32: warning: type ‘struct kmp_base_team’ violates the C++ One Definition Rule [-Wodr]
 2707 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2707:32: note: a different type is defined in another translation unit
 2707 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2776:26: note: the first difference of corresponding definitions is field ‘t_def_allocator’
 2776 |   omp_allocator_handle_t t_def_allocator; /* default allocator */
      |                          ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2776:26: note: a field of same name but different type is defined in another translation unit
 2776 |   omp_allocator_handle_t t_def_allocator; /* default allocator */
      |                          ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2707:32: note: type ‘omp_allocator_handle_t’ should match type ‘void *’
 2707 | typedef struct KMP_ALIGN_CACHE kmp_base_team {
      |                                ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2801:23: warning: type ‘union kmp_team’ violates the C++ One Definition Rule [-Wodr]
 2801 | union KMP_ALIGN_CACHE kmp_team {
      |                       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2801:23: note: a different type is defined in another translation unit
 2801 | union KMP_ALIGN_CACHE kmp_team {
      |                       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2802:19: note: the first difference of corresponding definitions is field ‘t’
 2802 |   kmp_base_team_t t;
      |                   ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2802:19: note: a field of same name but different type is defined in another translation unit
 2802 |   kmp_base_team_t t;
      |                   ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:2801:23: note: type ‘struct kmp_base_team_t’ itself violates the C++ One Definition Rule
 2801 | union KMP_ALIGN_CACHE kmp_team {
      |                       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:978:14: warning: type of ‘__kmpc_realloc’ does not match original declaration [-Wlto-type-mismatch]
  978 | extern void *__kmpc_realloc(int gtid, void *ptr, size_t sz,
      |              ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1636:7: note: type mismatch in parameter 4
 1636 | void *__kmpc_realloc(int gtid, void *ptr, size_t size,
     |       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1636:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1636:7: note: ‘__kmpc_realloc’ was previously declared here
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1636:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:981:13: warning: type of ‘__kmpc_free’ does not match original declaration [-Wlto-type-mismatch]
  981 | extern void __kmpc_free(int gtid, void *ptr, omp_allocator_handle_t al);
      |             ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1677:6: note: type mismatch in parameter 3
 1677 | void __kmpc_free(int gtid, void *ptr, const omp_allocator_handle_t allocator) {
      |      ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1677:6: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1677:6: note: ‘__kmpc_free’ was previously declared here
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1677:6: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:976:14: warning: type of ‘__kmpc_calloc’ does not match original declaration [-Wlto-type-mismatch]
  976 | extern void *__kmpc_calloc(int gtid, size_t nmemb, size_t sz,
      |              ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1603:7: note: type mismatch in parameter 4
 1603 | void *__kmpc_calloc(int gtid, size_t nmemb, size_t size,
      |       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1603:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1603:7: note: ‘__kmpc_calloc’ was previously declared here
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1603:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:975:14: warning: type of ‘__kmpc_alloc’ does not match original declaration [-Wlto-type-mismatch]
  975 | extern void *__kmpc_alloc(int gtid, size_t sz, omp_allocator_handle_t al);
      |              ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1460:7: note: type mismatch in parameter 3
 1460 | void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
      |       ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1460:7: note: type ‘void *’ should match type ‘omp_allocator_handle_t’
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1460:7: note: ‘__kmpc_alloc’ was previously declared here
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_alloc.cpp:1460:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:3131:21: warning: ‘__kmp_threads’ violates the C++ One Definition Rule [-Wodr]
 3131 | extern kmp_info_t **__kmp_threads; /* Descriptors for the threads */
      |                     ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_global.cpp:428:14: note: type ‘union kmp_info_t’ itself violates the C++ One Definition Rule
  428 | kmp_info_t **__kmp_threads = NULL;
      |              ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp.h:3131:21: warning: ‘__kmp_threads’ violates the C++ One Definition Rule [-Wodr]
 3131 | extern kmp_info_t **__kmp_threads; /* Descriptors for the threads */
      |                     ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_global.cpp:428:14: note: type ‘union kmp_info_t’ itself violates the C++ One Definition Rule
  428 | kmp_info_t **__kmp_threads = NULL;
      |              ^
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_global.cpp:428:14: note: ‘__kmp_threads’ was previously declared here
/builddir/build/BUILD/openmp-12.0.1.src/runtime/src/kmp_global.cpp:428:14: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
{standard input}: Assembler messages:
{standard input}: Error: invalid attempt to declare external version name as default in symbol `GOMP_atomic_end@@VERSION'
make: *** [/tmp/cc7tBjO4.mk:2: /tmp/ccHJOoRt.ltrans0.ltrans.o] Error 1
make: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed

Comment 1 Ben Cotton 2021-08-10 13:33:01 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 2 Nikita Popov 2022-09-12 16:12:25 UTC
Closing this as the LTO build works fine with LLVM 15, and we presumably don't want to go back and change this for older versions.