[PATCH] D135541: [TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 16:43:45 PDT 2022


rupprecht added a comment.

In D135541#3847905 <https://reviews.llvm.org/D135541#3847905>, @rupprecht wrote:

> FYI, I'm seeing some failures from this internally in some tests that do str <-> floating point conversion. I'll try to reduce a test case now; I'm not sure yet if this patch is doing something wrong.

Small-ish repro which uses absl:

  #include <iostream>
  #include "absl/strings/str_format.h"
  
  int main() {
    std::cout << absl::StrFormat("%.1g", 1e+15) << "\n";
    std::cout << absl::StrFormat("%.1g", 1e+20) << "\n";
    std::cout << absl::StrFormat("%.1g", 1e+25) << "\n";
    std::cout << absl::StrFormat("%.1g", 1e+30) << "\n";
    std::cout << absl::StrFormat("%.1g", 1e+35) << "\n";
  }

Before, it prints them as-is. After, it prints just the first three and then crashes:

  1e+15
  3e+28
  3e+35
  assert.h assertion failed at absl/strings/internal/str_format/float_conversion.cc:1006 in void absl::str_format_internal::(anonymous namespace)::Buffer::push_front(char): begin > data

I made a godbolt link, but trunk there hasn't caught up to this commit yet: https://godbolt.org/z/zbM1McdzM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135541/new/

https://reviews.llvm.org/D135541



More information about the llvm-commits mailing list