public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42625]  New: -fipa-sra can generate different destructors in different object files, binary breaks after linking
@ 2010-01-05 20:33 zsojka at seznam dot cz
  2010-01-05 20:36 ` [Bug tree-optimization/42625] " zsojka at seznam dot cz
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-05 20:33 UTC (permalink / raw)
  To: gcc-bugs

Tested revisions:
r155643 - broken
r155256 - broken
r154886 - broken
r154830 - OK

Command line:
in original testcases, all files are compiled with the same compiler parameters
for this reduced testcase, one file is compiled with "-O1 -fipa-sra", second
with just "-O1"
if -fipa-sra is expected to generate the same code independently on where the
function (destructor) is called from, I will open separate bugreport for that

Output:
g++ file1.cpp -O1 -fipa-sra -c && g++ file2.cpp -O1 -c && g++ file1.o file2.o
&& ./a.out
a.out: header.h:8: Object::~Object(): Assertion `i == 1' failed.

============ header.h ===========
#include <assert.h>

struct Object {
        int a, i;
        Object() : i(1) {};
        __attribute__((noinline)) ~Object()
        {
                assert(i == 1);
        }
        void del();
};
============ file1.cpp ==========
#include "header.h"

int main()
{
        delete new Object();
        (new Object())->del();
        return 0;
}
============ file1.cpp ==========
#include "header.h"

void Object::del()
{
        delete this;
}
=================================


-- 
           Summary: -fipa-sra can generate different destructors in
                    different object files, binary breaks after linking
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
@ 2010-01-05 20:36 ` zsojka at seznam dot cz
  2010-01-05 21:10 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-05 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-01-05 20:35 -------
Created an attachment (id=19474)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19474&action=view)
packed files (testcase)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
  2010-01-05 20:36 ` [Bug tree-optimization/42625] " zsojka at seznam dot cz
@ 2010-01-05 21:10 ` jakub at gcc dot gnu dot org
  2010-01-05 21:27 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-05 21:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-01-05 21:10 -------
I guess cgraph_make_node_local needs to update all same_body aliases (in
particular clear DECL_WEAK which etc. which made the alias externally visible).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
  2010-01-05 20:36 ` [Bug tree-optimization/42625] " zsojka at seznam dot cz
  2010-01-05 21:10 ` jakub at gcc dot gnu dot org
@ 2010-01-05 21:27 ` jakub at gcc dot gnu dot org
  2010-01-05 22:14 ` zsojka at seznam dot cz
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-05 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-01-05 21:26 -------
Created an attachment (id=19476)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19476&action=view)
gcc45-pr42625.patch

Untested fix.  No idea how to create a testcase though, dg-additional-sources
are compiled using the same command and this needs the sources compiled with
different options.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-01-05 21:27 ` jakub at gcc dot gnu dot org
@ 2010-01-05 22:14 ` zsojka at seznam dot cz
  2010-01-06 11:49 ` [Bug tree-optimization/42625] [4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-05 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from zsojka at seznam dot cz  2010-01-05 22:14 -------
Created an attachment (id=19477)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19477&action=view)
different testcase

Thank you for the quick fix.

Attached testcase fails even when both files are compiled with "-O1 -fipa-sra"
(order of files for linking is still important though)


-- 

zsojka at seznam dot cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #19474|0                           |1
        is obsolete|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] [4.5 Regression] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-01-05 22:14 ` zsojka at seznam dot cz
@ 2010-01-06 11:49 ` rguenth at gcc dot gnu dot org
  2010-01-07 14:52 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-06 11:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
            Summary|-fipa-sra can generate      |[4.5 Regression] -fipa-sra
                   |different destructors in    |can generate different
                   |different object files,     |destructors in different
                   |binary breaks after linking |object files, binary breaks
                   |                            |after linking
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] [4.5 Regression] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-01-06 11:49 ` [Bug tree-optimization/42625] [4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2010-01-07 14:52 ` rguenth at gcc dot gnu dot org
  2010-01-07 15:10 ` jakub at gcc dot gnu dot org
  2010-01-07 16:35 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-07 14:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] [4.5 Regression] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-01-07 14:52 ` rguenth at gcc dot gnu dot org
@ 2010-01-07 15:10 ` jakub at gcc dot gnu dot org
  2010-01-07 16:35 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-07 15:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-01-07 15:10 -------
Subject: Bug 42625

Author: jakub
Date: Thu Jan  7 15:10:26 2010
New Revision: 155694

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155694
Log:
        PR tree-optimization/42625
        * cgraph.c (cgraph_make_node_local): Clear DECL_COMDAT*,
        TREE_PUBLIC, DECL_WEAK and DECL_EXTERNAL also for same_body
        aliases.

        * g++.dg/opt/dtor4.C: New test.
        * g++.dg/opt/dtor4.h: New.
        * g++.dg/opt/dtor4-aux.cc: New.

Added:
    trunk/gcc/testsuite/g++.dg/opt/dtor4-aux.cc
    trunk/gcc/testsuite/g++.dg/opt/dtor4.C
    trunk/gcc/testsuite/g++.dg/opt/dtor4.h
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

* [Bug tree-optimization/42625] [4.5 Regression] -fipa-sra can generate different destructors in different object files, binary breaks after linking
  2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-01-07 15:10 ` jakub at gcc dot gnu dot org
@ 2010-01-07 16:35 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-07 16:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2010-01-07 16:35 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42625


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

end of thread, other threads:[~2010-01-07 16:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-05 20:33 [Bug tree-optimization/42625] New: -fipa-sra can generate different destructors in different object files, binary breaks after linking zsojka at seznam dot cz
2010-01-05 20:36 ` [Bug tree-optimization/42625] " zsojka at seznam dot cz
2010-01-05 21:10 ` jakub at gcc dot gnu dot org
2010-01-05 21:27 ` jakub at gcc dot gnu dot org
2010-01-05 22:14 ` zsojka at seznam dot cz
2010-01-06 11:49 ` [Bug tree-optimization/42625] [4.5 Regression] " rguenth at gcc dot gnu dot org
2010-01-07 14:52 ` rguenth at gcc dot gnu dot org
2010-01-07 15:10 ` jakub at gcc dot gnu dot org
2010-01-07 16:35 ` jakub at gcc dot gnu dot 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).