GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
i386

i386 SGX and PCONFIG intrinsics now "memory" clobber

Intel SGX and PCONFIG intrinsic wrappers now correctly declare memory side effects, preventing optimization issues.

GCC’s i386 backend has corrected inline assembly wrappers for Intel SGX (ENCLS, ENCLU, ENCLV) and PCONFIG intrinsics. These wrappers did not declare “memory” as a clobbered operand, leading the compiler’s data-flow analysis (DSE) and constant folding (FRE) passes to incorrectly optimize away stores to input structures or loads from output buffers. By adding the “memory” clobber, these intrinsics now accurately inform the compiler about their memory access side effects, preventing such optimizations and fixing PR128283. Additionally, the __encls_edbgrd intrinsic now correctly clobbers the “cc” flags.

In Details

Inline assembly templates for i386 SGX (__encls_*, __enclu_*, __enclv_*) and PCONFIG (__pconfig_b, __pconfig_generic) intrinsics are updated to include the 'memory' clobber. Previously, these wrappers used general-purpose registers for buffer pointers but failed to declare memory access. This caused issues with optimization passes like DSE and FRE, potentially removing essential memory operations. Adding 'memory' ensures correct code generation. The __encls_edbgrd intrinsic also gained the 'cc' clobber. Obsolete ` ` suffixes were removed from asm templates.

For Context
intrinsic
A function that maps directly to a specific machine instruction or a small sequence of instructions, often used for low-level hardware access.
clobber
In assembly, a clobber list specifies which registers or processor flags are modified by an instruction or a block of code, informing the compiler about side effects.
DSE
Dead Store Elimination, a compiler optimization pass that removes stores to variables that are never subsequently read.
FRE
Fold Reorder Elimination, a compiler optimization pass related to instruction scheduling and constant folding.
SGX
Intel Software Guard Extensions, a set of security technologies for creating hardware-isolated enclaves to protect sensitive code and data.
PCONFIG
A processor configuration instruction used on Intel architectures to manage various platform features, including Trusted Memory Encryption (TME).
Filed Under: i386optimizationsecurity