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

            Bug ID: 87501
           Summary: lto1: error: Alias and target's section differs
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

It's also an older issue:

$ cat 1.ii
struct a {
  virtual void f();
};
struct b : a {};
struct S : a, b {
  void f() {}
};
main() { S c; }

$ cat 2.ii
struct S {
  void f();
};
void S::f() {}

$  g++ -flto 1.ii 2.ii -fchecking
1.ii:5:8: warning: direct base ‘a’ inaccessible in ‘S’ due to ambiguity
 struct S : a, b {
        ^
1.ii:8:6: warning: ISO C++ forbids declaration of ‘main’ with no type
[-Wreturn-type]
 main() { S c; }
      ^
1.ii:5:8: warning: type ‘struct S’ violates the C++ One Definition Rule [-Wodr]
 struct S : a, b {
        ^
2.ii:1:8: note: a type with different bases is defined in another translation
unit
 struct S {
        ^
1.ii:6:8: warning: ‘f’ violates the C++ One Definition Rule  [-Wodr]
   void f() {}
        ^
2.ii:4:6: note: implicit this pointer type mismatch
 void S::f() {}
      ^
2.ii:1:8: note: type ‘struct S’ itself violates the C++ One Definition Rule
 struct S {
        ^
1.ii:5:8: note: the incompatible type is defined here
 struct S : a, b {
        ^
2.ii:4:6: note: ‘f’ was previously declared here
 void S::f() {}
      ^
2.ii:4:6: note: code may be misoptimized unless -fno-strict-aliasing is used
lto1: error: Alias and target's section differs
_ZN1S1fEv/26 (f) @0x7ffff657c5c0
  Type: function definition analyzed
  Visibility: force_output externally_visible no_reorder prevailing_def_ironly
public
  Address is taken.
  References: 
  Referring: *.LTHUNK0/1 (alias)_ZTV1S/13 (addr)
  Read from file: /tmp/ccaPfjxk.o
  First run: 0
  Function flags:
  Called by: 
  Calls: 
lto1: error: Alias and target's comdat groups differs
_ZN1S1fEv/26 (f) @0x7ffff657c5c0
  Type: function definition analyzed
  Visibility: force_output externally_visible no_reorder prevailing_def_ironly
public
  Address is taken.
  References: 
  Referring: *.LTHUNK0/1 (alias)_ZTV1S/13 (addr)
  Read from file: /tmp/ccaPfjxk.o
  First run: 0
  Function flags:
  Called by: 
  Calls: 
*.LTHUNK0/1 (*.LTHUNK0) @0x7ffff657c170
  Type: function definition analyzed alias
  Visibility: comdat_group:_ZN1S1fEv section:.text._ZN1S1fEv (implicit_section)
artificial
  Same comdat group as: _ZThn8_N1S1fEv/2
  References: _ZN1S1fEv/26 (alias)
  Referring: 
  Read from file: /tmp/ccF6bEVE.o
  First run: 0
  Function flags:
  Called by: _ZThn8_N1S1fEv/2 (can throw external) 
  Calls: 
(null):0: confused by earlier errors, bailing out
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Reply via email to