This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Provide inlining context in strict-overflow warnings

On Tue, May 13, 2014 at 09:27:08PM +0200, Florian Weimer wrote:
> Patterns that trigger the optimization and warning can form after
> inlining, and it can be rather difficult to figure out what exactly
> is causing the warning.  The inlining context at least provides
> additional hints, enabling developers to substitute the arguments
> and discover what, precisely, is happening.
> More context is provided with -g than without, but I think this is
> acceptable.
> I bootstrapped and tested the attached patch on
> x86_64-redhat-linux-gnu, with no new regressions.

This looks wrong.  If you want to print inline context, you just should
use %K%s and pass a tree with the right EXPR_LOCATION and TREE_BLOCK.
So perhaps:
  if (stmt == NULL)
    warning_at (input_location, OPT_Wstrict_overflow, "%s", warnmsg);
    warning_at (gimple_location (stmt), OPT_Wstrict_overflow, "%K%s",
		build_empty_stmt (gimple_location (stmt)), warnmsg);
(or add something similar to %K that will take location_t or change
%K to take location_t instead of tree now that we have both a block and
locus in location_t.

Note, your patch would happily crash if stmt is NULL.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]