public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42878]  New: "-fcompare-debug failure" at -O1 (2)
@ 2010-01-26 18:45 zsojka at seznam dot cz
  2010-01-26 18:46 ` [Bug tree-optimization/42878] " zsojka at seznam dot cz
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-26 18:45 UTC (permalink / raw)
  To: gcc-bugs

Command line:
gcc -O1 -fcompare-debug -c testcase.c

Tested revisions:
r156253 - crash
r155920 - crash
r155833 - crash
r155363 - crash
r154886 - crash
r154830 - OK
r153685 - OK

Output:
$ /mnt/svn/gcc-trunk/binary-156253-lto/bin/gcc -O1 -fcompare-debug -c
testcase.c
gcc: testcase.c: -fcompare-debug failure


-- 
           Summary: "-fcompare-debug failure" at -O1 (2)
           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
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
@ 2010-01-26 18:46 ` zsojka at seznam dot cz
  2010-01-26 19:31 ` zsojka at seznam dot cz
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-26 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-01-26 18:46 -------
Created an attachment (id=19717)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19717&action=view)
reduced testcase

Reduced from gcc/builtins.c

Command line:
gcc -O1 -fcompare-debug -c pr42878.c


-- 


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
  2010-01-26 18:46 ` [Bug tree-optimization/42878] " zsojka at seznam dot cz
@ 2010-01-26 19:31 ` zsojka at seznam dot cz
  2010-01-27 10:43 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-26 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from zsojka at seznam dot cz  2010-01-26 19:30 -------
Created an attachment (id=19718)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19718&action=view)
different reduced testcase

Reduced from gcc/builtins.c as well

This testcase started failing between r154830 and r154886 as well, so I am not
creating separate bugport for it.
All tested revisions fail at -O1, -O2 and -O3.

Command line:
gcc -O1 -fcompare-debug -c pr42878-2.c
or
gcc -O2 -fcompare-debug -c pr42878-2.c
or
gcc -O3 -fcompare-debug -c pr42878-2.c


-- 


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
  2010-01-26 18:46 ` [Bug tree-optimization/42878] " zsojka at seznam dot cz
  2010-01-26 19:31 ` zsojka at seznam dot cz
@ 2010-01-27 10:43 ` rguenth at gcc dot gnu dot org
  2010-01-27 11:26 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-27 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-01-27 10:42 -------
Confirmed.  It's loop header copying, or rather gimple_duplicate_sese_region,
that causes SSA name differences.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-27 10:42:56
               date|                            |


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-01-27 10:43 ` rguenth at gcc dot gnu dot org
@ 2010-01-27 11:26 ` rguenth at gcc dot gnu dot org
  2010-01-27 11:43 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-27 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-01-27 11:26 -------
But the root cause is SSA names get out-of sync already during early inlining
via .MEMs.  Which is because with debug isns we retain j_11 = 0 in

<bb 5>:
  # VUSE <.MEM_12>
  D.xxxx_10 = s_9->i;
  # .MEM_14 = VDEF <.MEM_12>
  e2 (D.xxxx_10);
  # DEBUG i => i_1(D)
  j_11 = 0;
  # DEBUG j => j_11
  # .MEM_15 = VDEF <.MEM_14>
  e2 (i_1(D));
  # DEBUG j => NULL
  return;

while without it's gone.

<bb 5>:
  # VUSE <.MEM_11>
  D.xxxx_10 = s_9->i;
  # .MEM_13 = VDEF <.MEM_11>
  e2 (D.xxxx_10);
  # .MEM_14 = VDEF <.MEM_13>
  e2 (i_1(D));
  return;


This is because

          /* By inlining function having uninitialized variable, we might
             extend the lifetime (variable might get reused).  This cause
             ICE in the case we end up extending lifetime of SSA name across
             abnormal edge, but also increase register pressure.

             We simply initialize all uninitialized vars by 0 except
             for case we are inlining to very first BB.  We can avoid
             this for all BBs that are not inside strongly connected
             regions of the CFG, but this is expensive to test.  */
          if (id->entry_bb
              && is_gimple_reg (SSA_NAME_VAR (name))
              && TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL
              && (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest
                  || EDGE_COUNT (id->entry_bb->preds) != 1))
            {
              gimple_stmt_iterator gsi = gsi_last_bb (id->entry_bb);
              gimple init_stmt;

              init_stmt = gimple_build_assign (new_tree,
                                               fold_convert (TREE_TYPE
(new_tree),
                                               integer_zero_node));


inserts this assignment also if there are only debug-uses.  We come along
here from re-mapping the default-defs of decls.


-- 


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-01-27 11:26 ` rguenth at gcc dot gnu dot org
@ 2010-01-27 11:43 ` rguenth at gcc dot gnu dot org
  2010-01-27 12:28 ` zsojka at seznam dot cz
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-27 11:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-01-27 11:43 -------
I have a patch.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-27 10:42:56         |2010-01-27 11:43:16
               date|                            |


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-01-27 11:43 ` rguenth at gcc dot gnu dot org
@ 2010-01-27 12:28 ` zsojka at seznam dot cz
  2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
  2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2010-01-27 12:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from zsojka at seznam dot cz  2010-01-27 12:28 -------
Created an attachment (id=19726)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19726&action=view)
different testcase, not crashing, but having difference in einline2 dump

This testcase passes the compare-debug test, but shows the behaviour you
described. In this case, there are no uninitialized variables though (I am not
aware of any). I hope this file can be useful.

Command line:
gcc -O1 -fcompare-debug testcase.c -c -fdump-tree-einline2
diff testcase.c.*024t.einline2


-- 


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-01-27 12:28 ` zsojka at seznam dot cz
@ 2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
  2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-27 16:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-01-27 16:00 -------
Subject: Bug 42878

Author: rguenth
Date: Wed Jan 27 16:00:31 2010
New Revision: 156291

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156291
Log:
2010-01-27  Richard Guenther  <rguenther@suse.de>

        PR middle-end/42878
        * tree-inline.c (remap_decl): Delay remapping of SSA name
        default definitions until we need them.

        * gcc.dg/torture/pr42878-1.c: New testcase.
        * gcc.dg/torture/pr42878-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr42878-1.c
    trunk/gcc/testsuite/gcc.dg/torture/pr42878-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c


-- 


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


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

* [Bug tree-optimization/42878] "-fcompare-debug failure" at -O1 (2)
  2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
@ 2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-27 16:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-01-27 16:00 -------
Subject: Bug 42878

Author: rguenth
Date: Wed Jan 27 16:00:31 2010
New Revision: 156291

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156291
Log:
2010-01-27  Richard Guenther  <rguenther@suse.de>

        PR middle-end/42878
        * tree-inline.c (remap_decl): Delay remapping of SSA name
        default definitions until we need them.

        * gcc.dg/torture/pr42878-1.c: New testcase.
        * gcc.dg/torture/pr42878-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr42878-1.c
    trunk/gcc/testsuite/gcc.dg/torture/pr42878-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c


------- Comment #8 from rguenth at gcc dot gnu dot org  2010-01-27 16:01 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-26 18:45 [Bug tree-optimization/42878] New: "-fcompare-debug failure" at -O1 (2) zsojka at seznam dot cz
2010-01-26 18:46 ` [Bug tree-optimization/42878] " zsojka at seznam dot cz
2010-01-26 19:31 ` zsojka at seznam dot cz
2010-01-27 10:43 ` rguenth at gcc dot gnu dot org
2010-01-27 11:26 ` rguenth at gcc dot gnu dot org
2010-01-27 11:43 ` rguenth at gcc dot gnu dot org
2010-01-27 12:28 ` zsojka at seznam dot cz
2010-01-27 16:01 ` rguenth at gcc dot gnu dot org
2010-01-27 16:01 ` rguenth 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).