Repository navigation
Description
Brief summary
Microsoft C/C++ Extension's IntelliSense (EDG parser) flags sp in a GCC inline asm clobber list as an error (severity 8) on ARM (ARMv7-M / Cortex-M3). The underlying concern is real — arm-none-eabi-gcc 15.2.1 also flags the same pattern, but as a warning (-Wdeprecated), not an error.
The problem is the severity mismatch: vscode-cpptools elevates what GCC treats as a deprecation warning to an error-level diagnostic in the Problems panel, making it indistinguishable from a hard compile-blocking error.
In any CMSIS-based Cortex-M3 project, every reference to __set_PSP / __set_MSP — the standard CMSIS helpers in core_cmFunc.h distributed by ARM and used by every silicon vendor (STM32, NXP, Nordic, ...) — is flagged at error severity.
Steps to reproduce
repro.c (no vendor dependency):
#include <stdint.h>
static inline void set_psp(uint32_t topOfProcStack)
{
__asm volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
}
static inline void set_msp(uint32_t topOfMainStack)
{
__asm volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
}
int main(void)
{
set_psp(0x20018000U);
set_msp(0x20018000U);
return 0;
}Minimal .vscode/c_cpp_properties.json:
{
"version": 4,
"configurations": [{
"name": "Cortex-M3",
"intelliSenseMode": "linux-gcc-arm",
"compilerPath": "<path-to>/arm-none-eabi-gcc",
"cStandard": "c11"
}]
}Open repro.c in VS Code → IntelliSense underlines "sp" in both clobber lists and reports the diagnostic at error severity in the Problems panel.
Expected behavior
A warning-level diagnostic is acceptable — GCC itself emits -Wdeprecated for this pattern. The expected behavior is that IntelliSense reports this at warning severity (matching GCC), not at error severity that visually masks real compile errors.
Actual behavior
IntelliSense reports the sp token in the clobber list at severity 8 (error). The error squiggle appears in the editor and the Problems panel for every translation unit that pulls in CMSIS core_cmFunc.h (i.e. essentially every Cortex-M project that calls __set_PSP / __set_MSP).
For comparison, arm-none-eabi-gcc 15.2.1 emits the same diagnostic at warning severity:
$ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O2 -Wall -Wextra -c repro.c -o repro.o warning: listing the stack pointer register 'sp' in a clobber list is deprecated [-Wdeprecated] note: the value of the stack pointer after an 'asm' statement must be the same as it was before the statement (emitted twice — once each for set_psp and set_msp)
The compile completes successfully (the diagnostic is -Wdeprecated, not -Werror=deprecated).
Configuration and Logs
| Item | Value |
|---|---|
| VS Code | 1.121.0 (x64, commit f6cfa2ea2403534de03f069bdf160d06451ed282) |
| C/C++ Extension | ms-vscode.cpptools 1.32.2 (win32-x64) |
| OS | Windows 11, build 10.0.26200.8457 |
| Compiler | Arm GNU Toolchain 15.2.Rel1 — arm-none-eabi-gcc 15.2.1 (2025-12-03 release) |
intelliSenseMode |
linux-gcc-arm |
cStandard |
c11 |
| Target | ARMv7-M (Cortex-M3) |
VS Code C/C++: Log Diagnostics and C/C++: Show Language Server Log outputs were not captured in this initial report. They can be regenerated and attached on maintainer request — the diagnostic is fully reproducible on demand from the minimal example above and does not depend on any workspace-specific state beyond the four-line c_cpp_properties.json shown above.
Related closed issues
May be related to the same EDG behavior previously addressed for other targets — though this issue is specifically about severity (error vs. warning), not about the parser rejecting the register name outright as was the case in the earlier reports:
- x86 inline ASM: "unknown register name" in clobber list #2090 — x86 clobber: closed as
fixed - AArch inline asm: "unknown register name" clobber list #4382 — AArch clobber: closed as
fixed(milestone 1.11.1) - ARM64 mode: inline assembler clobber registers are still wrongly reported as error #5381 — ARM64 clobber: closed as
more info needed - Add setting to suppress ASM related IntelliSense errors #7923 — Feature request to suppress ASM errors: closed as
more votes needed
If the EDG-side mapping for -Wdeprecated-class diagnostics on ARMv7-M inline asm reports them at error severity instead of warning, that may be the gap.
Notes
- GCC 15.2.1 also warns on this pattern:
arm-none-eabi-gcc-mcpu=cortex-m3 -mthumb -O2 -Wall -Wextraemits-Wdeprecatedfor the same code. The diagnostic is therefore not a false positive — but the severity (error vs. warning) differs from what GCC reports. - The
[-Wdeprecated]note from GCC reads: "the value of the stack pointer after an 'asm' statement must be the same as it was before the statement" — a valid ABI concern, but one that warrants a warning, not an error-level block. - The pattern is not exotic.
__set_PSP/__set_MSPare part of the ARM-distributed CMSIS-Core headers used by every silicon vendor for Cortex-M. Any CMSIS-based project hits this. - The diagnostic is IntelliSense-only at error severity; real builds with
arm-none-eabi-gcccomplete successfully.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
sean-mcmanus commentedon May 29, 2026
uoohyo (@uoohyo) Yes, it's a bug with EDG 6.8's handling of this with gcc mode (as can be confirmed via using that compiler on godbolt with
--g++ --gnu_version=160000. I've filed an internal VS issue 3009262 .sean-mcmanus commentedon Sep 4, 2026
uoohyo (@uoohyo) Fixed in https://github.com/microsoft/vscode-cpptools/releases/tag/v1.34.3 (pre-release).