[Lldb-commits] [PATCH] EmulationStateARM: Don't have >= comparisons against dwarf_r0

Todd Fiala tfiala at google.com
Wed Jul 30 14:06:15 PDT 2014


You could do that, but the semantic content issue is deeper than that.
 It's not only that r0 is 0, it's also that 0 is the bottom end of the
range for the comparison value type (unsigned something or another).  The
reason the compiler is warning is it happens to know that you can't have a
value lower than 0, so comparing to 0 (which we aren't using in the
expression, but the compiler is) is totally an optimization-related warning
from a visual/maintenance perspective.

I think the comment is probably fine.  If it were me, I'd rewrite it as a
range check against some kind of if in_range(low,high,value) or whatever.

I've said my peace, so however you guys want to deal with it, that's fine.
 At least a comment, though.


On Wed, Jul 30, 2014 at 2:03 PM, Ed Maste <emaste at freebsd.org> wrote:

> On 30 July 2014 16:49, Todd Fiala <tfiala at google.com> wrote:
> >
> > In this case, a comment is likely sufficient.
>
> How about a (static) assert that dwarf_r0 is 0, so that if someone
> ever does change it then this comparison be revisited?
>



-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140730/c7043ecf/attachment.html>


More information about the lldb-commits mailing list