public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/26475]  New: tree-ssa loses line numbers for initializations
@ 2006-02-26 21:02 drow at gcc dot gnu dot org
  2006-02-27 21:13 ` [Bug debug/26475] " drow at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: drow at gcc dot gnu dot org @ 2006-02-26 21:02 UTC (permalink / raw)
  To: gcc-bugs

Here's a simple testcase.  Compile with -O2 and look at the
-fdump-tree-all-lineno dumps:

int foo (int);
int bar (int a)
{
  int ndir = 0;
  int b;

  b = foo (a);
  while (b--)
    ndir = foo (ndir);
}

Early on, the ndir = 0 assignment is marked for line 4.  Then the 0 gets
propogated into a phi without a line number, which ends up associated with the
while loop (in a larger testcase, with the end of the instruction before the
loop instead of the start of the loop - not sure why a difference).  The
original assignment is DCE'd.

Then an exactly identical initialization is rematerialized (not surprising),
and the closest line number we could find was the line number of the statement
before the phi.

Obviously stepping over this in GDB looks unnecessarily strange.

Perhaps some PHI arguments could have line number information to be used on
edges when coming out of SSA?

FYI, original testcase comes from GDB's selftest.exp; we get a very surprising
line number associated with the first real instruction.


-- 
           Summary: tree-ssa loses line numbers for initializations
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drow at gcc dot gnu dot org
  GCC host triplet: x86_64-pc-linux-gnu


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


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

* [Bug debug/26475] tree-ssa loses line numbers for initializations
  2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
@ 2006-02-27 21:13 ` drow at gcc dot gnu dot org
  2008-02-10 14:51 ` [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs) manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: drow at gcc dot gnu dot org @ 2006-02-27 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from drow at gcc dot gnu dot org  2006-02-27 20:44 -------
Dan Berlin, Diego, and I bounced this around on IRC a little.  A couple of
things that came up:

  - Diego suggested putting locuses on unshared INTEGER_CSTs as another
possible approach.

  - I suggested that if we want line numbers to be useful with optimization, we
need to enforce and verify setting locuses.

  - Dan Berlin responded:

I think then a start may be to propose that we require EXPR_LOCATIOn on every
modify_expr to be non-null and verified by verify_stmts.  That will break
pretty much everywhere inserting code without locuses (which i know includes
PRE :P) As we discover where we need to propagate more info around (phi args,
wherever), we come up with a design for what needs to be done where.  The only
thing i know tries to keep line number info sane is tree-sra.c.  Things like
PRE should be using the line-number preserving sra_* functions (moved somewhere
else and renamed bsi_*_with_location).  Anyhoo, that's how i'd approach it.  As
you've said, there is no point in trying to put more information in places if
we don't keep the basic stmt info up to date :)


-- 


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


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

* [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs)
  2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
  2006-02-27 21:13 ` [Bug debug/26475] " drow at gcc dot gnu dot org
@ 2008-02-10 14:51 ` manu at gcc dot gnu dot org
  2009-07-24 23:40 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-10 14:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-02-10 14:50 -------
I think this is confirmed.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-10 14:50:21
               date|                            |


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


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

* [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs)
  2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
  2006-02-27 21:13 ` [Bug debug/26475] " drow at gcc dot gnu dot org
  2008-02-10 14:51 ` [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs) manu at gcc dot gnu dot org
@ 2009-07-24 23:40 ` manu at gcc dot gnu dot org
  2009-07-25  9:50 ` rguenth at gcc dot gnu dot org
  2009-07-30 18:40 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-24 23:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2009-07-24 23:40 -------
(In reply to comment #1)
> Dan Berlin, Diego, and I bounced this around on IRC a little.  A couple of
> things that came up:
> 
>   - Diego suggested putting locuses on unshared INTEGER_CSTs as another
> possible approach.

What would be the cost of this? This will help to give accurate diagnostics
even without optimization.


-- 


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


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

* [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs)
  2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-07-24 23:40 ` manu at gcc dot gnu dot org
@ 2009-07-25  9:50 ` rguenth at gcc dot gnu dot org
  2009-07-30 18:40 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-25  9:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-07-25 09:50 -------
I don't like unsharing constants.  Instead we could force all constants to
be assigned to SSA names so they have their own statement.  For PHI nodes
I believe Andrew has added location slots for each arg as part of the
debuglocus effort.


-- 


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


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

* [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs)
  2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-07-25  9:50 ` rguenth at gcc dot gnu dot org
@ 2009-07-30 18:40 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amacleod at redhat dot com @ 2009-07-30 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from amacleod at redhat dot com  2009-07-30 18:40 -------
I just checked in the code to track locations through PHI arguments.

Comments and patch is located:
http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01729.html


-- 


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


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

end of thread, other threads:[~2009-07-30 18:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-26 21:02 [Bug debug/26475] New: tree-ssa loses line numbers for initializations drow at gcc dot gnu dot org
2006-02-27 21:13 ` [Bug debug/26475] " drow at gcc dot gnu dot org
2008-02-10 14:51 ` [Bug debug/26475] tree-ssa loses line numbers for initializations (constants for PHIs) manu at gcc dot gnu dot org
2009-07-24 23:40 ` manu at gcc dot gnu dot org
2009-07-25  9:50 ` rguenth at gcc dot gnu dot org
2009-07-30 18:40 ` amacleod at redhat dot com

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