GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
mingw

MinGW: Quote symbols in Intel syntax to avoid misinterpretation.

This commit ensures that symbols are properly quoted in Intel syntax when using the MinGW compiler, resolving errors where symbols were misinterpreted as opera…

When compiling for MinGW targets using Intel syntax, symbols with names that conflicted with Intel assembler operators (like shl) were being misinterpreted, leading to compilation errors. This commit fixes the issue by using ASM_OUTPUT_LABELREF to ensure that symbols are properly quoted, preventing them from being treated as operators. This ensures correct code generation when using Intel assembly syntax with MinGW.

In Details

This commit modifies config/mingw/winnt.cc to use ASM_OUTPUT_LABELREF when emitting symbol names. This is necessary because the Intel assembly syntax can misinterpret symbol names that coincide with assembly operators. The ASM_OUTPUT_LABELREF macro ensures that the symbol is properly quoted, preventing the assembler from misinterpreting it as an operator. This issue is specific to the MinGW target and the Intel assembly syntax.

For Context

The MinGW compiler allows GCC to target Windows systems. This commit resolves an issue that arises when compiling code using Intel assembly syntax under MinGW. Specifically, if a variable name happened to be the same as an Intel assembly instruction (like shl, for "shift left"), the compiler would generate incorrect assembly code. The fix ensures that all variable names are properly quoted, so that the assembler always interprets them as variables and not instructions.

Filed Under: mingwassemblerbugfix