microsoft / microsoft/vscode-cpptools

Incorrect calculation of long double

Aperta
#13,399 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment
  • OS and Version: Debian 12
  • VS Code Version: 1.96.2
  • C/C++ Extension Version: 1.23.6
Bug Summary and Steps to Reproduce

Bug Summary:
The extension produces wrong value for calculations related to long double.

A. int cast to long double

Steps to reproduce:

  1. Write code like this:
const long double a = 1;
  1. Move the mouse pointer to a
  2. See error: the popup window shows -0.0L

Expected behavior:
The popup window shows 1.0L or so.

B. double cast to long double

Similar.

C. long double * long double

Steps to reproduce:

  1. Write code like this:
const long double a = 1.0L * 2.0L;
  1. Move the mouse pointer to a
  2. See error: the popup window shows 0.0L

Expected behavior:
The popup window shows 2.0L or so.

Configuration and Logs
{
    "configurations": [
        {
            "name": "Linux",
            "cppStandard": "c++23",
            "compilerPath": "${HOME}/usr/bin/g++",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}


-------- Diagnostics - 3/21/2025, 5:22:04 PM
Version: 1.23.6
Current Configuration:
{
    "name": "Linux",
    "cppStandard": "c++23",
    "compilerPath": "/home/iw17/usr/bin/g++",
    "includePath": [
        "/home/iw17/Documents/cpp/**"
    ],
    "defines": [],
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "${HOME}/usr/bin/g++",
    "cStandard": "c23",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/home/iw17/Documents/cpp/**",
            "${workspaceFolder}"
        ]
    }
}
Modified Settings:
{
    "C_Cpp.suggestSnippets": false,
    "C_Cpp.errorSquiggles": "enabled",
    "C_Cpp.default.cStandard": "c23",
    "C_Cpp.default.cppStandard": "c++23",
    "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false,
    "C_Cpp.vcFormat.indent.braces": true,
    "C_Cpp.vcFormat.indent.caseContentsWhenBlock": true,
    "C_Cpp.vcFormat.newLine.beforeCatch": false,
    "C_Cpp.vcFormat.newLine.beforeElse": false,
    "C_Cpp.vcFormat.space.withinInitializerListBraces": false,
    "C_Cpp.vcFormat.space.groupSquareBrackets": false,
    "C_Cpp.vcFormat.space.beforeInheritanceColon": false,
    "C_Cpp.vcFormat.space.beforeConstructorColon": false,
    "C_Cpp.vcFormat.space.pointerReferenceAlignment": "ignore",
    "C_Cpp.autoAddFileAssociations": false,
    "C_Cpp.addNodeAddonIncludePaths": true
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true,
        "**/.classpath": true,
        "**/.factorypath": true,
        "**/.project": true,
        "**/.settings": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "json"
}
cpptools version (native): 1.23.6.0
Current database path: /home/iw17/.cache/vscode-cpptools/ebd2e673b3dd5949bad93a40e0f18162/.browse.VC.db
Translation Unit Mappings:
[ /home/iw17/Documents/cpp/nongli-test/clean.cpp - source TU]:
[ /home/iw17/Documents/cpp/test/test.cpp - source TU]:
    /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h
Translation Unit Configurations:
[ /home/iw17/Documents/cpp/nongli-test/clean.cpp ]
    Process ID: 61200
    Memory Usage: 51 MB
    Compiler Path: /home/iw17/usr/bin/g++
    Includes:
    System Includes:
        /home/iw17/usr/include/c++/14.2.0
        /home/iw17/usr/include/c++/14.2.0/x86_64-pc-linux-gnu
        /home/iw17/usr/include/c++/14.2.0/backward
        /home/iw17/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include
        /usr/local/include
        /home/iw17/usr/include
        /home/iw17/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include-fixed
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++23
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=140200
[ /home/iw17/Documents/cpp/test/test.cpp ]
    Process ID: 64755
    Memory Usage: 19 MB
    Compiler Path: /home/iw17/usr/bin/g++
    Includes:
    System Includes:
        /home/iw17/usr/include/c++/14.2.0
        /home/iw17/usr/include/c++/14.2.0/x86_64-pc-linux-gnu
        /home/iw17/usr/include/c++/14.2.0/backward
        /home/iw17/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include
        /usr/local/include
        /home/iw17/usr/include
        /home/iw17/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.0/include-fixed
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++23
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=140200
Total Memory Usage: 70 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 6405
Number of files parsed: 1593
Other Extensions

The issue persists no matter whether all the other extensions are enabled or disabled.

Additional context

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci i valori al passaggio del mouse in clean.cpp e test.cpp usando la configurazione indicata Debian, GCC 14.2.0, C++23 e linux-gcc-x64. Parti dal percorso di valutazione del passaggio del mouse di IntelliSense e confronta la gestione delle espressioni int, double e long double; il lavoro è completato quando le dichiarazioni segnalate e la moltiplicazione mostrano i valori previsti senza influire sugli altri risultati al passaggio del mouse.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript, vscode
Ambito
compilers, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.