https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97529
Bug ID: 97529 Summary: Condition not constant folded Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jmuizelaar at mozilla dot com Target Milestone: --- >From https://github.com/rust-lang/rust/issues/74938 GCC compiles: #include <stddef.h> const size_t N = 3; int foo(size_t len) { size_t newlen = (len / N) * N; return newlen <= len; } to: foo: movabs rdx, -6148914691236517205 mov rax, rdi mul rdx mov rax, rdx and rdx, -2 shr rax add rdx, rax xor eax, eax cmp rdi, rdx setnb al ret N: .quad 3 clang: foo: # @foo mov eax, 1 ret N: .quad 3