microsoft / microsoft/vscode-cpptools

Incorrect calculation of long double

Offen
#13,399 2 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug Language Service Visual Studio
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die Hover-Werte in clean.cpp und test.cpp unter Verwendung der gemeldeten Konfiguration Debian, GCC 14.2.0, C++23 und linux-gcc-x64. Beginne beim IntelliSense-Hover-Auswertungspfad und vergleiche die Behandlung von Ausdrücken mit int, double und long double; abgeschlossen ist die Aufgabe, wenn die gemeldeten Deklarationen und die Multiplikation ihre erwarteten Werte anzeigen, ohne andere Hover-Ergebnisse zu beeinflussen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, typescript, vscode
Bereich
compilers, devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.