Menu

Internal error MathLib::toDoubleNumber

2023-10-17
2023-10-19
  • Norbert Lange

    Norbert Lange - 2023-10-17

    When analysing a project which has its own isolated math library,
    cppcheck chokes on definitions of float infinity. The code below is
    pretty much like many c libraries define those macros.

    file fail.c:

    #if 100*__GNUC__+__GNUC_MINOR__ >= 303 || defined(__clang__)
    #define NAN       __builtin_nanf("")
    #define INFINITY  __builtin_inff()
    #else
    #define NAN       (0.0f/0.0f)
    #define INFINITY  1e5000f
    #endif
    
    int main(int argc) {
    return INFINITY + argc;
    }
    

    Calling cppcheck on it:

    /tmp/lano/tmp_dir/fail.c:0:0: error: Internal Error. MathLib::toDoubleNumber: conversion failed: 1e5000f [cppcheckError]

     
  • CHR

    CHR - 2023-10-19

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12085

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.