public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-66180-4-LIduZqj0iJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66180-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
For example:

 % cat foo1.cpp
#include <memory>
namespace {
class A {
  int i;
};
}
class G {
  std::unique_ptr<A> foo() const;
};
std::unique_ptr<A> G::foo() const { return std::make_unique<A>(); }

 % cat foo2.cpp
#include <memory>
namespace {
class A {
  bool a;
};
}
class H {
  std::unique_ptr<A> bar() const;
};
std::unique_ptr<A> H::bar() const { return std::make_unique<A>(); }

 % g++ -flto -shared -std=c++14 foo1.cpp foo2.cpp
/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;
              ^
foo1.cpp:3:7: note: type ‘struct A’ defined in anonymous namespace can not
match type ‘struct A’
 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
‘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 different type is defined in another translation unit
       typedef _Tp                       element_type;
                                          ^
foo1.cpp:4:7: note: the first difference of corresponding definitions is field
‘i’
   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: <gcc-bugs-return-486732-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
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" <gcc-bugzilla@gcc.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: <bug-66180-4-2kkTD3J0De@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66180-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66180-4@http.gcc.gnu.org/bugzilla/>
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?idf180

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
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?


  parent reply	other threads:[~2015-05-19 21:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17  7:07 [Bug lto/66180] New: " trippels at gcc dot gnu.org
2015-05-17  7:19 ` [Bug lto/66180] " trippels at gcc dot gnu.org
2015-05-17  7:29 ` trippels at gcc dot gnu.org
2015-05-18 12:42 ` rguenth at gcc dot gnu.org
2015-05-19 17:56 ` hubicka at gcc dot gnu.org
2015-05-19 21:26 ` trippels at gcc dot gnu.org [this message]
2015-05-20  5:31 ` trippels at gcc dot gnu.org
2015-05-20 14:16 ` trippels at gcc dot gnu.org
2015-05-21  5:06 ` hubicka at gcc dot gnu.org
2015-05-24 19:38 ` hubicka at gcc dot gnu.org
2015-05-25  5:54 ` trippels at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66180-4-LIduZqj0iJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).