public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63896] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
@ 2014-11-15 18:16 ` fxcoudert at gcc dot gnu.org
  2014-11-15 18:26 ` [Bug target/63896] [5 Regression] " dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-apple-darwin14
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-15
          Component|c++                         |target
               Host|                            |x86_64-apple-darwin14
     Ever confirmed|0                           |1
              Build|                            |x86_64-apple-darwin14


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
@ 2014-11-15 18:16 fxcoudert at gcc dot gnu.org
  2014-11-15 18:16 ` [Bug target/63896] " fxcoudert at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63896
           Summary: g++.dg/ipa/devirt-7.C produces code that trips the
                    darwin linker
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org

g++.dg/ipa/devirt-7.C fails on x86_64-apple-darwin14: it generates code that
makes the darwin linker error out. Minimal reproducer is:

------------------------
class Distraction
{
  virtual float bar ();
};

class A
{
public:
  virtual void foo ();
};

class B : Distraction, A
{
public:
  void __attribute__ ((noinline)) middleman () { foo(); }
};

void A::foo ()
{
}

extern int get_input ();

int main (void)
{
  class B b;

  for (int i = 0; i < get_input(); i++)
    b.middleman();
}
------------------------

Compiling it with "./bin/g++ -W -Wall -O3 devirt-7.C", the linker aborts
uglily:

0  0x10d4fcb51  __assert_rtn + 144
1  0x10d524c99 
mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions
const&) + 3269
2  0x10d5080fd  mach_o::relocatable::Parser<x86_64>::parse(unsigned char
const*, unsigned long long, char const*, long, ld::File::Ordinal,
mach_o::relocatable::ParserOptions const&) + 375
3  0x10d54b8cd  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool)
+ 705
4  0x10d54d7ec  ld::tool::InputFiles::parseWorkerThread() + 496
5  0x7fff89c5f2fc  _pthread_body + 131
6  0x7fff89c5f279  _pthread_body + 0
A linker snapshot was created at:
    /tmp/a.out-2014-10-15-191218.ld-snapshot
ld: Assertion failed: (cfiStartsArray[i] != cfiStartsArray[i-1]), function
parse, file
/SourceCache/ld64/ld64-241.9/src/ld/parsers/macho_relocatable_file.cpp, line
1745.
collect2: error: ld returned 1 exit status


Here is a diff between the assembler code emitted by gcc 4.9.2 (which doesn't
trigger the ld issue), and that of trunk gcc:

--- good.s    2014-11-15 18:58:24.000000000 +0100
+++ bad.s    2014-11-15 18:58:14.000000000 +0100
@@ -23,7 +23,6 @@ LHOTB1:
     .align 4,0x90
 __ZN1B9middlemanEv.constprop.0:
 LFB12:
-    ret
 LFE12:
     .section __TEXT,__text_cold,regular,pure_instructions
 LCOLDE1:
@@ -37,19 +36,16 @@ LHOTB2:
     .globl _main
 _main:
 LFB2:
-    pushq    %rbx
+    subq    $24, %rsp
 LCFI0:
-    xorl    %ebx, %ebx
-    jmp    L4
-    .align 4
-L5:
-    addl    $1, %ebx
-L4:
     call    __Z9get_inputv
-    cmpl    %eax, %ebx
-    jl    L5
+    testl    %eax, %eax
+    jle    L4
+    movq    %rsp, %rdi
+    call    __ZN1B9middlemanEv.constprop.0
+L4:
     xorl    %eax, %eax
-    popq    %rbx
+    addq    $24, %rsp
 LCFI1:
     ret
 LFE2:
@@ -63,14 +59,19 @@ __ZTS1A:
     .ascii "1A\0"
     .globl __ZTI1A
     .const_data
-    .align 4
+    .align 3
 __ZTI1A:
     .quad    __ZTVN10__cxxabiv117__class_type_infoE+16
     .quad    __ZTS1A
+    .globl __ZTS1B
+    .weak_definition __ZTS1B
+    .section __TEXT,__const_coal,coalesced
+__ZTS1B:
+    .ascii "1B\0"
     .globl __ZTI1B
     .weak_definition __ZTI1B
     .section __DATA,__const_coal,coalesced
-    .align 5
+    .align 3
 __ZTI1B:
     .quad    __ZTVN10__cxxabiv121__vmi_class_type_infoE+16
     .quad    __ZTS1B
@@ -80,15 +81,9 @@ __ZTI1B:
     .quad    0
     .quad    __ZTI1A
     .quad    2048
-    .globl __ZTS1B
-    .weak_definition __ZTS1B
-    .section __TEXT,__const_coal,coalesced
-__ZTS1B:
-    .ascii "1B\0"
     .globl __ZTV1B
     .weak_definition __ZTV1B
-    .section __DATA,__const_coal,coalesced
-    .align 5
+    .align 3
 __ZTV1B:
     .quad    0
     .quad    __ZTI1B
@@ -98,7 +93,7 @@ __ZTV1B:
     .quad    __ZN1A3fooEv
     .globl __ZTV1A
     .const_data
-    .align 4
+    .align 3
 __ZTV1A:
     .quad    0
     .quad    __ZTI1A
@@ -158,9 +153,7 @@ LASFDE5:
     .set L$set$7,LCFI0-LFB2
     .long L$set$7
     .byte    0xe
-    .byte    0x10
-    .byte    0x83
-    .byte    0x2
+    .byte    0x20
     .byte    0x4
     .set L$set$8,LCFI1-LCFI0
     .long L$set$8


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/63896] [5 Regression] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
  2014-11-15 18:16 ` [Bug target/63896] " fxcoudert at gcc dot gnu.org
@ 2014-11-15 18:26 ` dominiq at lps dot ens.fr
  2014-11-17  9:12 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-11-15 18:26 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|g++.dg/ipa/devirt-7.C       |[5 Regression]
                   |produces code that trips    |g++.dg/ipa/devirt-7.C
                   |the darwin linker           |produces code that trips
                   |                            |the darwin linker

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This appeared between r217559 (PASS) and r217602 (FAIL).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/63896] [5 Regression] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
  2014-11-15 18:16 ` [Bug target/63896] " fxcoudert at gcc dot gnu.org
  2014-11-15 18:26 ` [Bug target/63896] [5 Regression] " dominiq at lps dot ens.fr
@ 2014-11-17  9:12 ` rguenth at gcc dot gnu.org
  2014-12-10 15:29 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-17  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/63896] [5 Regression] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-11-17  9:12 ` rguenth at gcc dot gnu.org
@ 2014-12-10 15:29 ` rguenth at gcc dot gnu.org
  2014-12-10 18:06 ` howarth at bromo dot med.uc.edu
  2014-12-10 19:03 ` dominiq at lps dot ens.fr
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So - is the linker input valid?  Please open a bug with Apple.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/63896] [5 Regression] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-12-10 15:29 ` rguenth at gcc dot gnu.org
@ 2014-12-10 18:06 ` howarth at bromo dot med.uc.edu
  2014-12-10 19:03 ` dominiq at lps dot ens.fr
  5 siblings, 0 replies; 7+ messages in thread
From: howarth at bromo dot med.uc.edu @ 2014-12-10 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

howarth at bromo dot med.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at bromo dot med.uc.edu

--- Comment #3 from howarth at bromo dot med.uc.edu ---
I don't see any linkage issues with g++.dg/ipa/devirt-7.C at r218585 on
x86_64-apple-darwin14.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/63896] [5 Regression] g++.dg/ipa/devirt-7.C produces code that trips the darwin linker
  2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-12-10 18:06 ` howarth at bromo dot med.uc.edu
@ 2014-12-10 19:03 ` dominiq at lps dot ens.fr
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-12-10 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I saw g++.dg/ipa/devirt-7.C failing at r217602, but it seems fixed since at
least r217634 (for which I may have applied the patch at
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01269.html). Likely fixed by
r217704 (patch committed).

Closing as FIXED (reopen if you disagree).


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-12-10 19:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15 18:16 [Bug c++/63896] New: g++.dg/ipa/devirt-7.C produces code that trips the darwin linker fxcoudert at gcc dot gnu.org
2014-11-15 18:16 ` [Bug target/63896] " fxcoudert at gcc dot gnu.org
2014-11-15 18:26 ` [Bug target/63896] [5 Regression] " dominiq at lps dot ens.fr
2014-11-17  9:12 ` rguenth at gcc dot gnu.org
2014-12-10 15:29 ` rguenth at gcc dot gnu.org
2014-12-10 18:06 ` howarth at bromo dot med.uc.edu
2014-12-10 19:03 ` dominiq at lps dot ens.fr

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).