microsoft / microsoft/vscode-cpptools
Incorrect calculation of long double
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
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:
- Write code like this:
const long double a = 1;
- Move the mouse pointer to
a - 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:
- Write code like this:
const long double a = 1.0L * 2.0L;
- Move the mouse pointer to
a - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hover values in clean.cpp and test.cpp using the reported Debian, GCC 14.2.0, C++23, and linux-gcc-x64 configuration. Start from the IntelliSense hover evaluation path and compare handling of int, double, and long double expressions; done means the reported declarations and multiplication show their expected values without affecting other hover results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100