public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
@ 2005-06-14  1:09 ian at airs dot com
  2005-06-14  1:34 ` [Bug debug/22057] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-06-14  1:09 UTC (permalink / raw)
  To: gcc-bugs

In this simple test case, setting a breakpoint at the start of the second for
loop is ineffective, even when compiling with -O0.

int
main(int argc, char **argv)
{
  int j;
  unsigned char block[6];

  for (j = 0; j < 4; j++)
    block[j] = (unsigned char) j;

  for (; j < 6; j++)
    block[j] = (unsigned char) j;
} 

The second for loop is compiled into code like this:

    goto L1;
  L2:
    block[j] = (unsigned char) j;
    j += 1;
  L1:
    if (j < 6)
      goto L2;

The first goto has no line number information.  The increment to j is marked
with the line of the start of the for loop (as it should be).  The effect is
that if you use gdb on the program and set a breakpoint on the start of the for
loop, that breakpoint will not be hit until the "j += 1" statement is executed,
at which point the loop has already been executed once.  This can be seen in
gdb, or by using objdump -dl.

This would be perfectly understandable when optimizing, of course, but -O0 -g
should support maximum debuggability, and should certainly permit setting a
breakpoint at the start of a loop.  Presumably the fix is to mark the "goto L1"
statement with the appropriate line number.

This works correctly with gcc 3.4.3, which generates different code in any case.

-- 
           Summary: [4.0/4.1 Regression] Poor -O0 debug information for for
                    loops with no initializer
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug debug/22057] [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
@ 2005-06-14  1:34 ` pinskia at gcc dot gnu dot org
  2005-06-14 13:21 ` [Bug middle-end/22057] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14  1:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.1


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


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

* [Bug middle-end/22057] [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
  2005-06-14  1:34 ` [Bug debug/22057] " pinskia at gcc dot gnu dot org
@ 2005-06-14 13:21 ` pinskia at gcc dot gnu dot org
  2005-07-08  1:39 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 13:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-14 13:21 -------
Confirmed, I thought the gimplifier would have to change but it is not that.
If we look at .eh (via -fdump-tree-all-lineno), we see that there is a goto with the lineno of 10:
  [t.c : 7] j = 0;
  [t.c : 7] goto <D1243>;
  <D1242>:;
  [t.c : 8] j.0 = j;
  [t.c : 8] D.1249 = (unsigned char) j;
  [t.c : 8] block[j.0] = D.1249;
  [t.c : 7] j = j + 1;
  <D1243>:;
  [t.c : 7] if ([t.c : 7] j <= 3) [t.c : 7] goto <D1242>; else [t.c : 7] goto <D1244>;
  <D1244>:;
  [t.c : 10] goto <D1246>;  /// <--- here
  <D1245>:;
  [t.c : 11] j.1 = j;
  [t.c : 11] D.1251 = (unsigned char) j;
  [t.c : 11] block[j.1] = D.1251;
  [t.c : 10] j = j + 1;
  <D1246>:;
  [t.c : 10] if ([t.c : 10] j <= 5) [t.c : 10] goto <D1245>; else [t.c : 10] goto <D1247>;
  <D1247>:;
  [t.c : 12] return;

So it is just tree CFG cleanup which is causing this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org, hubicka at gcc dot gnu
                   |                            |dot org
             Status|UNCONFIRMED                 |NEW
          Component|debug                       |middle-end
     Ever Confirmed|                            |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-14 13:21:45
               date|                            |


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


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

* [Bug middle-end/22057] [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
  2005-06-14  1:34 ` [Bug debug/22057] " pinskia at gcc dot gnu dot org
  2005-06-14 13:21 ` [Bug middle-end/22057] " pinskia at gcc dot gnu dot org
@ 2005-07-08  1:39 ` mmitchel at gcc dot gnu dot org
  2005-07-13 20:44 ` ian at airs dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-08  1:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.1                       |4.0.2


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


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

* [Bug middle-end/22057] [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
                   ` (2 preceding siblings ...)
  2005-07-08  1:39 ` mmitchel at gcc dot gnu dot org
@ 2005-07-13 20:44 ` ian at airs dot com
  2005-07-18 23:25 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-07-13 20:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-07-13 20:11 -------
Proposed patch here: http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00954.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug middle-end/22057] [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
                   ` (3 preceding siblings ...)
  2005-07-13 20:44 ` ian at airs dot com
@ 2005-07-18 23:25 ` cvs-commit at gcc dot gnu dot org
  2005-07-19  0:51 ` [Bug middle-end/22057] [4.0 " ian at airs dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-18 23:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-18 23:20 -------
Subject: Bug 22057

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ian@gcc.gnu.org	2005-07-18 23:20:09

Modified files:
	gcc            : ChangeLog tree-cfgcleanup.c 

Log message:
	PR middle-end/22057
	* tree-cfgcleanup.c (cleanup_tree_cfg): Only remove forwarder
	blocks when optimizing.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9469&r2=2.9470
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-cfgcleanup.c.diff?cvsroot=gcc&r1=2.2&r2=2.3



-- 


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


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

* [Bug middle-end/22057] [4.0 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
                   ` (4 preceding siblings ...)
  2005-07-18 23:25 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-19  0:51 ` ian at airs dot com
  2005-07-19  6:27 ` cvs-commit at gcc dot gnu dot org
  2005-07-19  7:15 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-07-19  0:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-07-18 23:24 -------
Fixed on mainline, still present on 4.0 branch

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ian at airs dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-06-14 13:21:45         |2005-07-18 23:24:52
               date|                            |
            Summary|[4.0/4.1 Regression] Poor - |[4.0 Regression] Poor -O0
                   |O0 debug information for for|debug information for for
                   |loops with no initializer   |loops with no initializer


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


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

* [Bug middle-end/22057] [4.0 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
                   ` (5 preceding siblings ...)
  2005-07-19  0:51 ` [Bug middle-end/22057] [4.0 " ian at airs dot com
@ 2005-07-19  6:27 ` cvs-commit at gcc dot gnu dot org
  2005-07-19  7:15 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-19  6:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-19 06:26 -------
Subject: Bug 22057

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	ian@gcc.gnu.org	2005-07-19 06:25:58

Modified files:
	gcc            : ChangeLog tree-cfg.c 

Log message:
	PR middle-end/22057
	* tree-cfg.c (cleanup_tree_cfg): Only remove forwarder blocks when
	optimizing.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.318&r2=2.7592.2.319
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-cfg.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.151.2.1&r2=2.151.2.2



-- 


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


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

* [Bug middle-end/22057] [4.0 Regression] Poor -O0 debug information for for loops with no initializer
  2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
                   ` (6 preceding siblings ...)
  2005-07-19  6:27 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-19  7:15 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2005-07-19  7:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ian at airs dot com  2005-07-19 06:27 -------
Fixed everywhere.

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


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


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

end of thread, other threads:[~2005-07-19  6:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14  1:09 [Bug debug/22057] New: [4.0/4.1 Regression] Poor -O0 debug information for for loops with no initializer ian at airs dot com
2005-06-14  1:34 ` [Bug debug/22057] " pinskia at gcc dot gnu dot org
2005-06-14 13:21 ` [Bug middle-end/22057] " pinskia at gcc dot gnu dot org
2005-07-08  1:39 ` mmitchel at gcc dot gnu dot org
2005-07-13 20:44 ` ian at airs dot com
2005-07-18 23:25 ` cvs-commit at gcc dot gnu dot org
2005-07-19  0:51 ` [Bug middle-end/22057] [4.0 " ian at airs dot com
2005-07-19  6:27 ` cvs-commit at gcc dot gnu dot org
2005-07-19  7:15 ` ian at airs 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).