[lto] Emit location information for statements

Tom Tromey tromey@redhat.com
Mon May 18 17:32:00 GMT 2009


>>>>> "Diego" == Diego Novillo <dnovillo@google.com> writes:

Diego> As referenced in my previous message
Diego> (http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00927.html), this
Diego> patch emits location information for statements in gimple files.

I saw something odd in this patch.  I don't know whether it is a bug
or not, but I figured I would mention it just in case.

Diego> +static void
Diego> +output_stmt_location (struct output_block *ob, gimple stmt)
Diego> +{
Diego> +  expanded_location xloc;
Diego> +
Diego> +  xloc = expand_location (gimple_location (stmt));
Diego> +  if (xloc.file == NULL)
Diego> +    {
Diego> +      output_string (ob, ob->main_stream, xloc.file);
Diego> +      return;
Diego> +    }
Diego> +
Diego> +  output_string (ob, ob->main_stream, xloc.file);
Diego> +  output_sleb128 (ob, xloc.line);
Diego> +  output_sleb128 (ob, xloc.column);

This conditionally emits the line and column based on file != NULL.

Diego> +static location_t
Diego> +input_stmt_location (struct lto_input_block *ib, struct data_in *data_in)
Diego> +{
[...]
Diego> +  file = input_string (data_in, ib);
Diego> +  line = lto_input_sleb128 (ib);
Diego> +  column = lto_input_sleb128 (ib);

... but this seems to unconditionally read the line and column.

Tom



More information about the Gcc-patches mailing list