From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95549 invoked by alias); 19 May 2015 21:26:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 95511 invoked by uid 48); 19 May 2015 21:26:03 -0000 From: "trippels at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/66180] [6 Regression] many -Wodr false positives when building LLVM with -flto Date: Tue, 19 May 2015 21:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: trippels at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg01571.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66180 --- Comment #5 from Markus Trippelsdorf --- For example: % cat foo1.cpp #include namespace { class A { int i; }; } class G { std::unique_ptr foo() const; }; std::unique_ptr G::foo() const { return std::make_unique(); } % cat foo2.cpp #include namespace { class A { bool a; }; } class H { std::unique_ptr bar() const; }; std::unique_ptr H::bar() const { return std::make_unique(); } % g++ -flto -shared -std=3Dc++14 foo1.cpp foo2.cpp /home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:102:12: warning: type =E2=80=98struct _Head_base=E2=80=99 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 fi= rst difference of corresponding definitions is field =E2=80=98_M_head_impl=E2= =80=99 _Head _M_head_impl; ^ /home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:147:13: note: a fiel= d of same name but different type is defined in another translation unit _Head _M_head_impl; ^ foo1.cpp:3:7: note: type =E2=80=98struct A=E2=80=99 defined in anonymous na= mespace can not match type =E2=80=98struct A=E2=80=99 class A { ^ foo2.cpp:3:7: note: the incompatible type defined in anonymous namespace in another translation unit class A { ^ /home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:180:12: warning: type =E2=80=98struct _Tuple_impl=E2=80=99 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 =E2=80=98struct tuple=E2=80=99 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 =E2=80=98struct unique_ptr=E2=80=99 violates one definition r= ule [-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 =E2=80=98_= M_t=E2=80=99 __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 transla= tion unit __tuple_type _M_t; ^ /home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:146:57: note: type =E2=80=98struct __tuple_type=E2=80=99 should match type =E2=80= =98struct __tuple_type=E2=80=99 that itself violate one definition rule typedef std::tuple __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 __tuple_type; ^ /home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:151:41: warning: type =E2=80=98struct element_type=E2=80=99 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 different type is defined in another translation unit typedef _Tp element_type; ^ foo1.cpp:4:7: note: the first difference of corresponding definitions is fi= eld =E2=80=98i=E2=80=99 int i; ^ foo2.cpp:4:8: note: a field with different name is defined in another translation unit bool a; ^ >>From gcc-bugs-return-486732-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 19 22:35:53 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 119353 invoked by alias); 19 May 2015 22:35:51 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 119306 invoked by uid 48); 19 May 2015 22:35:45 -0000 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/66180] [6 Regression] many -Wodr false positives when building LLVM with -flto Date: Tue, 19 May 2015 22:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg01572.txt.bz2 Content-length: 274 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66180 --- Comment #6 from Jan Hubicka --- Thank you for the testcase! With the fix for anonymous types I don't seem to get the warnings. Can you, please, check if that works for you and commit it?