[PATCH] Update source location for PRE inserted stmt

Xinliang David Li davidxl@google.com
Mon Nov 5 17:00:00 GMT 2012


For the example I listed, the new statement is generated for source
construct at program point (2). However unlike simple code motion, (2)
is not going away after PRE. How would setting the location of the new
statement at the insertion point break coverage? Besides, the new
statement won't create 'false' coverage for the insertion point either
as the there are existing statements at that point where the new stmt
inherits the location from.

David

On Mon, Nov 5, 2012 at 3:54 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Those compiler generated statements do not have source origins, but
>> they need to have debug location information attached so that
>> information collected for them can be correlated with program
>> constructs (such as CFG). One of the natural way is to use the source
>> location associated with the program point where they are inserted.
>
> No, there is nothing natural (and this can even be wrong).  The statements
> must have the source location corresponding to the source construct they are
> generated for, which may be totally different from that of the insertion
> point.  Yes, that can generate jumpiness in GDB, but this is far better that
> breaking the coverage info by giving the same source location to instructions
> that have different coverage status.
>
> --
> Eric Botcazou



More information about the Gcc-patches mailing list