https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120433
--- Comment #3 from fujin zhao <bigmagicreadsun at gmail dot com> --- (In reply to fujin zhao from comment #2) > I've refactored a0_in_asm() as requested, but the result remains unchanged. > Here’s the updated implementation: > > > __attribute__((noinline)) uint32_t a0_in_asm() { > uint32_t result; > asm volatile ( > "lui %0, 0xFFFF\n" // Load upper 20 bits > "slli %0, %0, 0x4\n" // Shift left by 4 > "addi %0, %0, 0x231\n"// Add lower 12 bits > : "=r" (result) // Output to 'result' > : // No input operands > : "a0" // Clobber list (a0 modified) > ); > return result; // Explicit return > } > > Here's the complete example: > > https://godbolt.org/z/eTK5bna3o Apologies, I misread earlier — the result is actually correct now.