• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillwater-sc / universal / 26332478004
84%
master: 84%

Build:
Build:
LAST BUILD BRANCH: fix/issue-1002-ereal-highprec-constants
DEFAULT BRANCH: master
Ran 23 May 2026 12:46PM UTC
Jobs 1
Files 656
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 May 2026 12:19PM UTC coverage: 84.276% (-0.02%) from 84.291%
26332478004

push

github

web-flow
fix(cfloat): work around clang miscompile in to_native<long double> (#938)

cfloat::to_native<TargetFloat>() used the pattern
    1.0f / TargetFloat(1ull << -exponent)
to compute 2^(-N) for negative unbiased exponents. clang -O2 (and
-O0, even with -fno-fast-math) miscompiles this expression for
TargetFloat == long double via a buggy direct-bit-pattern optimisation
that fiddles with the IEEE 754 80-bit exponent field, producing NaN or
the wrong magnitude:

  v   half->(double)   half->(long double)
  ----------------------------------------
  0.125    0.125              NaN
  0.25     0.25               0.5
  0.5      0.5                NaN
  1.0      1.0                1.0
  1.5      1.5                1.5

gcc and MSVC compile the original pattern correctly; the bug is
clang-specific. MSVC additionally aliases long double to double, so the
broken path could never have been observed on the Windows leg of CI.

Workaround: replace the negative-exponent branch with
`std::ldexp(TargetFloat(1), exponent)`, which clang compiles correctly
for all FpType. The positive-exponent branch retains the original bit
shift since (a) clang compiles it correctly and (b) the bit shift is a
constexpr-evaluable expression while ldexp is not constexpr in C++20.

There are two occurrences of the buggy pattern in cfloat_impl.hpp (the
hasMaxExpValues / non-hasMaxExpValues code paths); both are patched in
the same way.

Test added: static/float/cfloat/conversion/long_double_conversion.cpp
sweeps representative cfloat<N,E> configurations and asserts
  static_cast<long double>(cf{v}) == (long double) static_cast<double>(cf{v})
for v in {0, 0.125, 0.25, 0.5, 1.0, 1.5, 2.0, 3.25, -1.5, 0.0625, 0.015625}.
LONG_DOUBLE_SUPPORT guarded so MSVC continues to pass.

Validation
- gcc 13.3 debug + release: full cfloat conversion suite (9 tests) PASS,
  including the new long_double_conversion regression.
- clang 18.1 debug + release: same. The clang-release build is the
  configuration whe... (continued)

6 of 6 new or added lines in 1 file covered. (100.0%)

10 existing lines in 1 file now uncovered.

47108 of 55897 relevant lines covered (84.28%)

5266640.79 hits per line

Coverage Regressions

Lines Coverage ∆ File
10
31.43
-3.57% include/sw/universal/verification/test_suite_randoms.hpp
Jobs
ID Job ID Ran Files Coverage
1 26332478004.1 23 May 2026 12:46PM UTC 656
84.28
GitHub Action Run
Source Files on build 26332478004
  • Tree
  • List 656
  • Changed 3
  • Source Changed 1
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26332478004
  • 3f49c046 on github
  • Prev Build on main (#26331745527)
  • Next Build on main (#26338255293)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc