[all-commits] [llvm/llvm-project] 6b8d07: [libc] Fix incorrect unsigned comparison (#135595)

Wu Yingcong via All-commits all-commits at lists.llvm.org
Wed Apr 16 18:34:09 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b8d072cfd41f647f2c241f0a1a0843a279d049b
      https://github.com/llvm/llvm-project/commit/6b8d072cfd41f647f2c241f0a1a0843a279d049b
  Author: Wu Yingcong <yingcong.wu at intel.com>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    M libc/src/stdio/printf_core/float_dec_converter.h

  Log Message:
  -----------
  [libc] Fix incorrect unsigned comparison (#135595)

There is a problem with such unsigned comparison pattern:
```
if(unsigned_a - unsigned_b > 0) { /* only NOT go here when unsigned_a==unsigned_b */ }
```
When `unsigned_a` < `unsigned_b`, the result will still be `>0` due to
underflow.
This patch fixes two of the occurrences I found.
Also remove two redundant `if` where its condition is guaranteed by
outer `if`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list