public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
@ 2015-02-27 13:49 marxin at gcc dot gnu.org
  2015-02-27 13:50 ` [Bug ipa/65236] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-02-27 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65236
           Summary: [5 Regression]: IPA ICF causes miscompilation in
                    Chromium built with -Os
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: marxin at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org

Starting from r221040 ICF introduced new wrapper (thunk) created for a couple
of symbols in chromium (protoc binary).

Semantic equality hit:std::__cxx11::string
google::protobuf::MessageLite::SerializePartialAsString()
const->std::__cxx11::string google::protobuf::MessageLite::SerializeAsString()
const
Assembler symbol
names:_ZNK6google8protobuf11MessageLite24SerializePartialAsStringEv->_ZNK6google8protobuf11MessageLite17SerializeAsStringEv
std::__cxx11::string google::protobuf::MessageLite::SerializePartialAsString()
const (const struct MessageLiteD.25422 * const thisD.27459)
{
  <bb 2>:
  _9 = &MEM[(struct basic_string *)output_3(D)].D.16928._M_local_buf;
  MEM[(struct _Alloc_hider *)output_3(D)]._M_p = _9;
  MEM[(size_type *)output_3(D) + 8B] = 0;
  MEM[(char_type &)output_3(D) + 16] = 0;
  _7 = google::protobuf::MessageLite::AppendPartialToString (this_5(D),
output_3(D));
  if (_7 != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  MEM[(size_type *)output_3(D) + 8B] = 0;
  _4 = MEM[(const struct basic_string *)output_3(D)];
  MEM[(char_type &)_4] = 0;

  <bb 4>:
  return output_3(D);

}


std::__cxx11::string google::protobuf::MessageLite::SerializeAsString() const
(const struct MessageLiteD.25422 * const thisD.27454)
{
  <bb 2>:
  _8 = &MEM[(struct basic_string *)output_3(D)].D.16928._M_local_buf;
  MEM[(struct _Alloc_hider *)output_3(D)]._M_p = _8;
  MEM[(size_type *)output_3(D) + 8B] = 0;
  MEM[(char_type &)output_3(D) + 16] = 0;
  _4 = google::protobuf::MessageLite::AppendPartialToString (this_5(D),
output_3(D));
  if (_4 != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  MEM[(size_type *)output_3(D) + 8B] = 0;
  _6 = MEM[(const struct basic_string *)output_3(D)];
  MEM[(char_type &)_6] = 0;

  <bb 4>:
  return output_3(D);

}

Unified; Wrapper has been created.


Optimized dump:
Removing basic block 5
std::__cxx11::string google::protobuf::MessageLite::SerializePartialAsString()
const (const struct MessageLite * const this)
{
  char * const _4;
  bool _7;
  char[16] * _9;

  <bb 2>:
  _9 = &MEM[(struct basic_string *)output_3(D)].D.16928._M_local_buf;
  MEM[(struct _Alloc_hider *)output_3(D)]._M_p = _9;
  MEM[(size_type *)output_3(D) + 8B] = 0;
  MEM[(char_type &)output_3(D) + 16] = 0;
  _7 = google::protobuf::MessageLite::AppendPartialToString (this_5(D),
output_3(D));
  if (_7 != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  MEM[(size_type *)output_3(D) + 8B] = 0;
  _4 = MEM[(const struct basic_string *)output_3(D)];
  MEM[(char_type &)_4] = 0;

  <bb 4>:
  return output_3(D);

}



;; Function std::__cxx11::string
google::protobuf::MessageLite::SerializeAsString() const
(_ZNK6google8protobuf11MessageLite17SerializeAsStringEv, funcdef_no=1252,
decl_uid=25508, cgraph_uid=355, symbol_order=356)

std::__cxx11::string google::protobuf::MessageLite::SerializeAsString() const
(const struct MessageLite * const this)
{
  <bb 2>:
  *output_2(D) = google::protobuf::MessageLite::SerializePartialAsString
(this_3(D)); [tail call]
  return output_2(D);

}

Unfortunately, emitted assembly is miscompiled with double free (memory
corruption) error.
I'm going to attach RTL dumps.

Martin


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
@ 2015-02-27 13:50 ` marxin at gcc dot gnu.org
  2015-02-27 16:45 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-02-27 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 34888
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34888&action=edit
RTL dumps without ICF
>From gcc-bugs-return-478728-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 27 13:10:51 2015
Return-Path: <gcc-bugs-return-478728-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 88862 invoked by alias); 27 Feb 2015 13:10: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 88798 invoked by uid 48); 27 Feb 2015 13:10:43 -0000
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
Date: Fri, 27 Feb 2015 14:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: marxin at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-65236-4-6wRtgY4Gmv@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65236-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65236-4@http.gcc.gnu.org/bugzilla/>
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-02/txt/msg03060.txt.bz2
Content-length: 243

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 34889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34889&action=edit
RTL dumps with ICF
>From gcc-bugs-return-478729-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 27 13:20:16 2015
Return-Path: <gcc-bugs-return-478729-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 37316 invoked by alias); 27 Feb 2015 13:20:16 -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 37261 invoked by uid 55); 27 Feb 2015 13:20:10 -0000
From: "ktietz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgcc/65038] [regression 5] Unable to find ftw.h for libgcov-util.c
Date: Fri, 27 Feb 2015 14:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libgcc
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: blocker
X-Bugzilla-Who: ktietz at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65038-4-3lRrpzOGLN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65038-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65038-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-02/txt/msg03061.txt.bz2
Content-length: 783

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide038

--- Comment #6 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Author: ktietz
Date: Fri Feb 27 13:19:38 2015
New Revision: 221059

URL: https://gcc.gnu.org/viewcvs?rev"1059&root=gcc&view=rev
Log:
        PR target/65038
        * config.in: Regenerated.
        * configure: Likewise.
        * configure.ac (AC_HEADER_STDC): Added explicit.
        (AC_CHECK_HEADERS): Check for default headers  plus
        for ftw.h header.
        * libgcov-util.c (gcov_read_profile_dir): Disable use
        of ftw-function, if header is not found.
        (ftw_read_file): Likewise.


Modified:
    trunk/libgcc/ChangeLog
    trunk/libgcc/config.in
    trunk/libgcc/configure
    trunk/libgcc/configure.ac
    trunk/libgcc/libgcov-util.c


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
  2015-02-27 13:50 ` [Bug ipa/65236] " marxin at gcc dot gnu.org
@ 2015-02-27 16:45 ` marxin at gcc dot gnu.org
  2015-02-27 23:49 ` hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-02-27 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
There's generated assembly:

000000000045faa0
<_ZNK6google8protobuf11MessageLite24SerializePartialAsStringEv>:
  45faa0:    53                       push   %rbx
  45faa1:    48 89 fb                 mov    %rdi,%rbx
  45faa4:    48 89 f7                 mov    %rsi,%rdi
  45faa7:    48 8d 43 10              lea    0x10(%rbx),%rax
  45faab:    48 c7 43 08 00 00 00     movq   $0x0,0x8(%rbx)
  45fab2:    00 
  45fab3:    c6 43 10 00              movb   $0x0,0x10(%rbx)
  45fab7:    48 89 de                 mov    %rbx,%rsi
  45faba:    48 89 03                 mov    %rax,(%rbx)
  45fabd:    e8 0e ff ff ff           callq  45f9d0
<_ZNK6google8protobuf11MessageLite21AppendPartialToStringEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE>
  45fac2:    84 c0                    test   %al,%al
  45fac4:    75 0e                    jne    45fad4
<_ZNK6google8protobuf11MessageLite24SerializePartialAsStringEv+0x34>
  45fac6:    48 8b 03                 mov    (%rbx),%rax
  45fac9:    48 c7 43 08 00 00 00     movq   $0x0,0x8(%rbx)
  45fad0:    00 
  45fad1:    c6 00 00                 movb   $0x0,(%rax)
  45fad4:    48 89 d8                 mov    %rbx,%rax
  45fad7:    5b                       pop    %rbx
  45fad8:    c3                       retq   
  45fad9:    00 00                    add    %al,(%rax)
  45fadb:    00 00                    add    %al,(%rax)
  45fadd:    00 00                    add    %al,(%rax)
    ...

000000000045fae0 <_ZNK6google8protobuf11MessageLite17SerializeAsStringEv>:
  45fae0:    53                       push   %rbx
  45fae1:    48 89 fb                 mov    %rdi,%rbx
  45fae4:    48 83 ec 20              sub    $0x20,%rsp
  45fae8:    48 89 e7                 mov    %rsp,%rdi
  45faeb:    e8 b0 ff ff ff           callq  45faa0
<_ZNK6google8protobuf11MessageLite24SerializePartialAsStringEv>
  45faf0:    48 8b 04 24              mov    (%rsp),%rax

(marker)
----------------------------------------------------------------------vvvv

  45faf4:    48 89 03                 mov    %rax,(%rbx)
  45faf7:    48 8b 44 24 08           mov    0x8(%rsp),%rax
  45fafc:    48 89 43 08              mov    %rax,0x8(%rbx)
  45fb00:    48 8b 44 24 10           mov    0x10(%rsp),%rax
  45fb05:    48 89 43 10              mov    %rax,0x10(%rbx)
  45fb09:    48 8b 44 24 18           mov    0x18(%rsp),%rax
  45fb0e:    48 89 43 18              mov    %rax,0x18(%rbx)
  45fb12:    48 83 c4 20              add    $0x20,%rsp
  45fb16:    48 89 d8                 mov    %rbx,%rax
  45fb19:    5b                       pop    %rbx
  45fb1a:    c3                       retq   
  45fb1b:    00 00                    add    %al,(%rax)
  45fb1d:    00 00                    add    %al,(%rax)

Where I suspect a stack load/store instruction after returning from the call
------^^^^
>From gcc-bugs-return-478763-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 27 15:55:15 2015
Return-Path: <gcc-bugs-return-478763-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 35381 invoked by alias); 27 Feb 2015 15:55:15 -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 35351 invoked by uid 48); 27 Feb 2015 15:55:11 -0000
From: "jana at saout dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/65239] New: typeinfo / VTT for some classes not visibile in shared library when LTO is used
Date: Fri, 27 Feb 2015 16:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jana at saout dot de
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-65239-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-02/txt/msg03095.txt.bz2
Content-length: 3685

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide239

            Bug ID: 65239
           Summary: typeinfo / VTT for some classes not visibile in shared
                    library when LTO is used
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jana at saout dot de

I am seeing a possible issue with LTO that just seems to have appeared in GCC
5.

When trying to link against the shared library "libgtkmm-2.4.so.1" from gtkmm
2.4 with -flto, I sometimes get complaints that the vtable or VTT for
"Gtk::TreeViewColumn" cannot be found.

In fact:

nm -C .libs/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for
Gtk::TreeViewColumn'
00000000002fa8c8 d VTT for Gtk::TreeViewColumn [clone .lto_priv.731]
0000000000323410 d vtable for Gtk::TreeViewColumn [clone .lto_priv.732]

objdump -tC .libs/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for
Gtk::TreeViewColumn'
00000000002fa8c8 l     O .data.rel.ro.local    0000000000000038
.hidden VTT for Gtk::TreeViewColumn [clone .lto_priv.731]
0000000000323410 l     O .data.rel.ro    00000000000000b8              .hidden
vtable for Gtk::TreeViewColumn [clone .lto_priv.732]

(-T comes back empty)


Not using LTO everything is fine (as is LTO with 4.9.2):

objdump -TC /usr/lib64/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for
Gtk::TreeViewColumn'
000000319a72b7e8  w   DO .data.rel.ro    0000000000000038  Base        VTT for
Gtk::TreeViewColumn
000000319a72b820  w   DO .data.rel.ro    00000000000000b8  Base        vtable
for Gtk::TreeViewColumn



The symbols are from here:

gcc-nm -C .libs/treeviewcolumn.o | egrep '(vtable|VTT) for Gtk::TreeViewColumn'
00000000 W VTT for Gtk::TreeViewColumn
00000000 W vtable for Gtk::TreeViewColumn



Note that if I create a shared library just from that single (slim LTO) object
file, the vtable/VTT are there:

g++ -shared -o x.so -flto -save-temps .libs/treeviewcolumn.o
objdump -tC x.so | egrep '(vtable|VTT) for Gtk::TreeViewColumn'
00000000000097e0 l     O .data.rel.ro    00000000000000b8              vtable
for Gtk::TreeViewColumn
00000000000098b8 l     O .data.rel.ro.local    0000000000000038
VTT for Gtk::TreeViewColumn

If I

g++ -shared -o x.so -flto -save-temps .libs/*.o (whole bunch of object files)

I am getting the shared library where the vtable/VTT are missing (or rather
just have hidden clones). Note that all other vtable/VTT are there, it's just
the Gtk::TreeViewVolumn ones that are missing.



Tested with the latest (20150226) SVN version.


The .res file says:

grep ZT.\*TreeViewColumnE\$ -- -lm.res
10602 218553227c96204c RESOLVED_IR _ZTTN3Gtk14TreeViewColumnE
4750 218553227c96204c RESOLVED_IR _ZTVN3Gtk14TreeViewColumnE
9268 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTIN3Gtk14TreeViewColumnE
4192 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTVN3Gtk14TreeViewColumnE
9270 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTTN3Gtk14TreeViewColumnE
9287 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTSN3Gtk14TreeViewColumnE
14067 f3ebcd2e3bf3a025 RESOLVED_IR _ZTIN3Gtk14TreeViewColumnE


(the shared library where the vtable/VTT aren't missing doesn't contain the
RESOLVED_IR lines, just the four PREVAILING_DEF_IRONLY_EXP ones)

This happens with just "-O2 -flto" on an x86_64 system.

I'm not sure how to reduce the testcase or provide further information but can
try to provide further information if you can tell me what you need.

I've uploaded the object files here:
https://www.dropbox.com/s/0rmzoxtpbdq8lc7/objectfiles.tar.gz?dl=0

( g++ -shared -o x.so *.o )


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
  2015-02-27 13:50 ` [Bug ipa/65236] " marxin at gcc dot gnu.org
  2015-02-27 16:45 ` marxin at gcc dot gnu.org
@ 2015-02-27 23:49 ` hubicka at gcc dot gnu.org
  2015-02-28  1:02 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-02-27 23:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-27
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
One bug with thunks I am aware of is demonstrated by the following testcase:
struct A {                                                                      
  A() {ptr=&b;}                                                                 
  A(const A &a) {ptr = &b;}                                                     
  void test() { if (ptr != &b) __builtin_abort ();}                             
  int b;                                                                        
  int *ptr;                                                                     
};                                                                              

A test1(A a)
{
  a.test();
  return a;
}
A test2(A a)
{
  a.test();
  return a;
}
__attribute__ ((noinline))
void
test_me (A (*t)(A))
{
  struct A a, b=t(a);
  b.test ();
}
int
main()
{
  test_me (test1);
  test_me (test2);
  return 0;
}

we turn test2 into a thunk but after inlining the thunk we end up with
producing extrra copy of return value A.


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-02-27 23:49 ` hubicka at gcc dot gnu.org
@ 2015-02-28  1:02 ` hubicka at gcc dot gnu.org
  2015-02-28 21:40 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-02-28  1:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
This is the code generated for thunk:
_Z5test11A:                                                                     
.LFB12:                                                                         
        .cfi_startproc                                                          
        pushq   %rbx                                                            
        .cfi_def_cfa_offset 16                                                  
        .cfi_offset 3, -16                                                      
        movq    %rdi, %rbx                                                      
        subq    $16, %rsp                                                       
        .cfi_def_cfa_offset 32                                                  
        movq    %rsp, %rdi                                                      
        call    _Z5test21A                                                      
        movq    (%rsp), %rax                                                    
        movq    %rax, (%rbx)                                                    
        movq    8(%rsp), %rax                                                   
        movq    %rax, 8(%rbx)                                                   
        addq    $16, %rsp                                                       
        .cfi_def_cfa_offset 16                                                  
        movq    %rbx, %rax                                                      
        popq    %rbx                                                            
        .cfi_def_cfa_offset 8                                                   
        ret                                                                     

which is wrong; the extra copy should not exist.


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-02-28  1:02 ` hubicka at gcc dot gnu.org
@ 2015-02-28 21:40 ` hubicka at gcc dot gnu.org
  2015-02-28 22:46 ` hubicka at gcc dot gnu.org
  2015-03-02  8:46 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-02-28 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Sat Feb 28 20:32:15 2015
New Revision: 221077

URL: https://gcc.gnu.org/viewcvs?rev=221077&root=gcc&view=rev
Log:

    PR ipa/65236
    * g++.dg/ipa/ipa-icf-6.C: New testcase.
    * cgraphunit.c (cgraph_node::expand_thunk): Enable return slot
    opt.

Added:
    trunk/gcc/testsuite/g++.dg/ipa/ipa-icf-6.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-28 21:40 ` hubicka at gcc dot gnu.org
@ 2015-02-28 22:46 ` hubicka at gcc dot gnu.org
  2015-03-02  8:46 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-02-28 22:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Fixed.


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

* [Bug ipa/65236] [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os
  2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-02-28 22:46 ` hubicka at gcc dot gnu.org
@ 2015-03-02  8:46 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-02  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


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

end of thread, other threads:[~2015-03-02  8:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 13:49 [Bug ipa/65236] New: [5 Regression]: IPA ICF causes miscompilation in Chromium built with -Os marxin at gcc dot gnu.org
2015-02-27 13:50 ` [Bug ipa/65236] " marxin at gcc dot gnu.org
2015-02-27 16:45 ` marxin at gcc dot gnu.org
2015-02-27 23:49 ` hubicka at gcc dot gnu.org
2015-02-28  1:02 ` hubicka at gcc dot gnu.org
2015-02-28 21:40 ` hubicka at gcc dot gnu.org
2015-02-28 22:46 ` hubicka at gcc dot gnu.org
2015-03-02  8:46 ` rguenth at gcc dot gnu.org

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