[Bug debug/48866] gcc hangs when -g is set

aoliva at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 5 13:06:00 GMT 2011


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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |aoliva at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2011-05-05 12:59:35 UTC ---
Created attachment 24189
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24189
Patch that works around the problem

It is TER that considers the loads as replaceable and ends up moving the entire
computation past the debug stmts.  Considering that MEMs are the reason for the
inefficiency in cselib, and I don't think replacing loads into addresses of
other loads brings us much (any?) benefit, I came up with this hack that fixes
the problem.

We can't really use the incoming argument for debug info very long: it dies at
the first use.  So, even though this patch keeps the debug insns at the
expected place, and we bind the user variables properly, the binding of y
doesn't survive: the value stored in it dies at the first use, on the next
insn, and we can't construct an expression based on a chain of MEMs because (as
mentioned above) the incoming argument, which held the address of the first
MEM, is already dead.

With this patch, the expression stored in z is still regarded as replaceable,
so the debug insn is bound to a MEM before the load, but after var-tracking,
another location expression is emitted with the REG into which the MEM is
loaded.



More information about the Gcc-bugs mailing list