https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107063
Bug ID: 107063 Summary: [X86_64 codegen] Using inc eax instead of inc dword ptr Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: hiraditya at msn dot com Target Milestone: --- int volatile gv = 0; void foo() { ++gv; } $ gcc -Os foo(): mov eax, DWORD PTR gv[rip] inc eax mov DWORD PTR gv[rip], eax ret gv: .zero 4 $ clang -Os foo(): # @foo() inc dword ptr [rip + gv] ret gv: .long 0 https://godbolt.org/z/vzq4jr5vj