[Bug debug/44205] Wrong .debug_line for -O0 -g
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu May 20 14:44:00 GMT 2010
------- Comment #2 from jakub at gcc dot gnu dot org 2010-05-20 14:44 -------
Created an attachment (id=20711)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20711&action=view)
gcc46-pr44205.patch
Doing it at gimplification time would be actually very hard, we only create the
continue label after then block is gimplified and only if it could fall
through.
Here is an attempt to fix this by removing forwarder blocks even at -O0 during
tree cfg cleanup if they don't care any useful location info (either everything
is UNKNOWN_LOCATION as in this testcase, or everything has the same location).
The goto to the cont label intentionally has no location:
g = gimple_build_goto (label_cont);
/* GIMPLE_COND's are very low level; they have embedded
gotos. This particular embedded goto should not be marked
with the location of the original COND_EXPR, as it would
correspond to the COND_EXPR's condition, not the ELSE or the
THEN arms. To avoid marking it with the wrong location, flag
it as "no location". */
gimple_set_do_not_emit_location (g);
and nothing else on the edges here has any locus either, so I believe nothing
is lost by removing the forwarder block. We then avoid removing the forwarder
block at RTL cleanup time when the extra jump already has some, in this case
undesirable, location.
This patch definitely needs testing on gdb testsuite if it doesn't regress
anything at -O0 -g.
--
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=44205
More information about the Gcc-bugs
mailing list