You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9a4cfe6
Browse filesBrowse the repository at this point in the historyBrowse files
Fix #12282 (Internal error: fail to parse 1.0e4931L) (#8952)
Trac: https://trac.cppcheck.net/ticket/12282
A float literal out of the range of `double` stops the analysis of the
whole file:
Internal Error. MathLib::toDoubleNumber: conversion failed: 1.0e4931L
`MathLib::toDoubleNumber()` reads the literal with an `istringstream`.
For a value out of range the stream stores the largest finite value and
sets `failbit`, which became the internal error. Compilers make such a
literal infinity, so this does the same.
Besides `long double` constants like the one in the ticket, a common
trigger is glibc's `math.h` when the GCC builtins are not used:
`HUGE_VAL`/`HUGE_VALF` are then `1e10000`/`1e10000f`, so any file using
`INFINITY` or `HUGE_VAL` hit this.
Tests: new cases in `TestMathLib::toDoubleNumber` (`1e10000`,
`1e10000f`, `1e10000L`, `1.5E+400`, `1.0e4931L`); they fail without the
change.
0 commit comments