[PATCH] Changed loop variable from int to uint32_t in llvm-cov

Bob Wilson bob.wilson at apple.com
Tue Oct 22 13:59:56 PDT 2013


It would depend on how the value gets used, and I didn't actually check the context very carefully since I think your patch makes sense regardless.

On Oct 22, 2013, at 1:31 PM, Yuchen Wu <yuchenericwu at hotmail.com> wrote:

> The loop itself would not break but the use of an negative integer as an index would break, no?
> 
> Subject: Re: [PATCH] Changed loop variable from int to uint32_t in llvm-cov
> From: bob.wilson at apple.com
> Date: Tue, 22 Oct 2013 13:08:49 -0700
> CC: llvm-commits at cs.uiuc.edu
> To: yuchenericwu at hotmail.com
> 
> I don't think there is a real problem with overflow here because the loop exit conditions are using != comparisons.  Even if the int values overflow, that should not change the behavior of those comparisons.  (It would be different for less-than and greater-than comparisons.)  But, I've applied your patch anyway since it makes sense to be consistent with the types used for the loop bounds.  r193192
> 
> On Oct 22, 2013, at 10:52 AM, Yuchen Wu <yuchenericwu at hotmail.com> wrote:
> 
> Changed a couple of loop variables in llvm-cov to uint32_t when the condition statement contains a comparison to uint32_t.
> <0005-Changed-index-variable-from-int-to-uint32_t.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131022/6e3801d7/attachment.html>


More information about the llvm-commits mailing list