https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66180

            Bug ID: 66180
           Summary: [6 Regression] many -Wodr false positives when
                    building LLVM with -flto
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org
  Target Milestone: ---

for example:
trippels@gcc2-power8 llvm_build % cmake -DCMAKE_INSTALL_PREFIX=~/llvm-install
-DCMAKE_BUILD_TYPE=release -DLLVM_ENABLE_ASSERTIONS=on
-DLLVM_TARGETS_TO_BUILD="PowerPC" -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3
-DNDEBUG -pipe -flto=60"
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-O1,--hash-style=gnu,--gc-sections,--icf=safe"
-DENABLE_PIC=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DLLVM_BINUTILS_INCDIR=/home/trippels/include
-DCMAKE_C_COMPILER=/home/trippels/gcc_6/usr/local/bin/gcc
-DCMAKE_CXX_COMPILER=/home/trippels/gcc_6/usr/local/bin/g++ ~/llvm

trippels@gcc2-power8 llvm_build % make -j120
...
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
warning: type ‘struct __aligned_buffer’ violates one definition rule [-Wodr]
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
note: a type with the same name but different base type is defined in another
translation unit
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/type_traits:1985:12: note:
type name ‘std::aligned_storage<104ul, 8ul>’ should match type name
‘std::aligned_storage<96ul, 8ul>’  
     struct aligned_storage
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/type_traits:1985:12: note: the
incompatible type is defined here
     struct aligned_storage
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_tree.h:134:12:
warning: type ‘struct _Rb_tree_node’ violates one definition rule [-Wodr]
     struct _Rb_tree_node : public _Rb_tree_node_base
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_tree.h:134:12: note:
a different type is defined in another translation unit
     struct _Rb_tree_node : public _Rb_tree_node_base
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_tree.h:149:41: note:
the first difference of corresponding definitions is field ‘_M_storage’
       __gnu_cxx::__aligned_buffer<_Val> _M_storage;
                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_tree.h:149:41: note:
a field of same name but different type is defined in another translation unit
       __gnu_cxx::__aligned_buffer<_Val> _M_storage;
                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
note: type ‘struct __aligned_buffer’ should match type ‘struct
__aligned_buffer’ that itself violate one definition rule
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
note: the incompatible type is defined here
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:96:12:
warning: type ‘struct pair’ violates one definition rule [-Wodr]
     struct pair
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:96:12: note: a
different type is defined in another translation unit
     struct pair
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:102:11: note:
the first difference of corresponding definitions is field ‘second’
       _T2 second;                /// @c second is a copy of the second object
            ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:102:11: note:
a field of same name but different type is defined in another translation unit
       _T2 second;                /// @c second is a copy of the second object
            ^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp:131:10:
note: type ‘struct GroupInfo’ defined in anonymous namespace can not match type
‘struct GroupInfo’
   struct GroupInfo {
           ^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangSACheckersEmitter.cpp:73:8:
note: the incompatible type defined in anonymous namespace in another
translation unit
 struct GroupInfo {
         ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:99:19:
warning: type ‘struct second_type’ violates one definition rule [-Wodr]
       typedef _T2 second_type;   /// @c second_type is the second bound type
                    ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:99:19: note: a
different type is defined in another translation unit
       typedef _T2 second_type;   /// @c second_type is the second bound type
                    ^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp:132:32:
note: the first difference of corresponding definitions is field ‘DiagsInGroup’
     std::vector<const Record*> DiagsInGroup;
                                 ^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangSACheckersEmitter.cpp:74:33:
note: a field with different name is defined in another translation unit
   llvm::DenseSet<const Record*> Checkers;
                                  ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
warning: type ‘struct __aligned_buffer’ violates one definition rule [-Wodr]
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/ext/aligned_buffer.h:43:12:
note: a type with the same name but different base type is defined in another
translation unit
     struct __aligned_buffer
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/type_traits:1985:12: note:
type name ‘std::aligned_storage<96ul, 8ul>’ should match type name
‘std::aligned_storage<104ul, 8ul>’  
     struct aligned_storage
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/type_traits:1985:12: note: the
incompatible type is defined here
     struct aligned_storage
             ^
...
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:102:12: warning: type
‘struct _Head_base’ violates one definition rule [-Wodr]
     struct _Head_base<_Idx, _Head, false>
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:102:12: note: a
different type is defined in another translation unit
     struct _Head_base<_Idx, _Head, false>
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:147:13: note: the first
difference of corresponding definitions is field ‘_M_head_impl’
       _Head _M_head_impl;
              ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:147:13: note: a field of
same name but different type is defined in another translation unit
       _Head _M_head_impl;
              ^
/home/trippels/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp:28:7: note: type
‘struct FunctionArgEnumerator’ defined in anonymous namespace can not match
type ‘struct FunctionArgEnumerator’
 class FunctionArgEnumerator : public IPDBEnumChildren<PDBSymbolData> {
        ^
/home/trippels/llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp:24:7: note:
the incompatible type defined in anonymous namespace in another translation
unit
 class FunctionArgEnumerator : public IPDBEnumSymbols {
        ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:180:12: warning: type
‘struct _Tuple_impl’ violates one definition rule [-Wodr]
     struct _Tuple_impl<_Idx, _Head, _Tail...>
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:180:12: note: a type
with different bases is defined in another translation unit
     struct _Tuple_impl<_Idx, _Head, _Tail...>
             ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:596:11: warning: type
‘struct tuple’ violates one definition rule [-Wodr]
     class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
            ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:596:11: note: a type
with different bases is defined in another translation unit
     class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
            ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:129:11:
warning: type ‘struct unique_ptr’ violates one definition rule [-Wodr]
     class unique_ptr
            ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:129:11:
note: a different type is defined in another translation unit
     class unique_ptr
            ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:147:57:
note: the first difference of corresponding definitions is field ‘_M_t’
       __tuple_type                                      _M_t;
                                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:147:57:
note: a field of same name but different type is defined in another translation
unit
       __tuple_type                                      _M_t;
                                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:146:57:
note: type ‘struct __tuple_type’ should match type ‘struct __tuple_type’ that
itself violate one definition rule
       typedef std::tuple<typename _Pointer::type, _Dp>  __tuple_type;
                                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:146:57:
note: the incompatible type is defined here
       typedef std::tuple<typename _Pointer::type, _Dp>  __tuple_type;
                                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:151:41:
warning: type ‘struct element_type’ violates one definition rule [-Wodr]
       typedef _Tp                       element_type;
                                          ^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:151:41:
note: a type with the same name but different base type is defined in another
translation unit
       typedef _Tp                       element_type;
                                          ^
/home/trippels/llvm/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h:18:37: note:
type name ‘llvm::IPDBEnumChildren<llvm::PDBSymbol>’ should match type name
‘llvm::IPDBEnumChildren<llvm::PDBSymbolData>’
 template <typename ChildType> class IPDBEnumChildren {
                                      ^
/home/trippels/llvm/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h:18:37: note:
the incompatible type is defined here
 template <typename ChildType> class IPDBEnumChildren {
                                      ^
etc.

Reply via email to