https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112928
Bug ID: 112928
Summary: missed-optimization: automatic storage address
comparisons
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: goon.pri.low at gmail dot com
Target Milestone: ---
This code:
int unopt() {
int a, b;
return &a < &b;
}
unopt:
lea rax, [rsp-4]
lea rdx, [rsp-8]
cmp rdx, rax
setb al
movzx eax, al
ret
Could really just be optimized to
opt:
mov eax, 1
ret