This is the mail archive of the gcc-patches@gcc.gnu.org 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] Emit accurate debug info for short-circuit operators


On Tue, 21 Apr 2009, Eric Botcazou wrote:

> > These changes are OK.
> 
> Thanks.
> 
> > > 	* c-typeck.c (build_unary_op) <TRUTH_NOT_EXPR>: Reset the location if
> > > 	TRUTH_NOT_EXPR has been folded.
> >
> > Could you explain why this is needed in more detail?  Why isn't the
> > location passed in to build_unary_op always appropriate for the final
> > location setting?
> 
> This location is that of the '!'; when it is folded, for example
> 
>   !(a || b) => !a && !b
> 
> you don't want to put this location on the '&&' but preserve that of the '||'.

I suppose this is OK for now then; I think either location is just as 
good.  But I hope that for diagnostic purposes we'll eventually track 
ranges of locations for expressions rather than just a single location, 
and then the range would be that for all the tokens !(a || b); if for 
debug info purposes the start of the range isn't good enough, then you 
need to track both the range for diagnostics and an individual location 
for debug info.

-- 
Joseph S. Myers
joseph@codesourcery.com


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