[all-commits] [llvm/llvm-project] 0d59cf: [libc] fix -Wconversion in float_to_string.h (#74369)

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Mon Dec 4 13:13:04 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d59cfc7a3446dc6078dfc57783048f490d8d998
      https://github.com/llvm/llvm-project/commit/0d59cfc7a3446dc6078dfc57783048f490d8d998
  Author: Nick Desaulniers <nickdesaulniers at users.noreply.github.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M libc/src/__support/float_to_string.h

  Log Message:
  -----------
  [libc] fix -Wconversion in float_to_string.h (#74369)

Fixes:
libc/src/__support/float_to_string.h:551:48: error: conversion from
‘long
unsigned int’ to ‘int32_t’ {aka ‘int’} may change value
[-Werror=conversion]
551 | const int32_t shift_amount = SHIFT_CONST + (-exponent - IDX_SIZE *
idx);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Observed in gcc fullbuilds.

IDX_SIZE is a size_t (aka 'long unsigned int'), but has the value 128,
so the
expression is undergoing implicit promotion.

Link: https://lab.llvm.org/buildbot/#/builders/250/builds/14891




More information about the All-commits mailing list