[Bug c/123960] Incorrect pointer address calculation on x64.

sz.tarnowski at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 3 23:34:04 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123960

--- Comment #5 from Szymon Tarnowski <sz.tarnowski at gmail dot com> ---
Do you mean in code like "ptr = memory + -((unsigned int)*ptr)"
"-((unsigned int)*ptr)" has unsigned value 0xFFFFFFFF which is promoted to
0x00000000_FFFFFFFF before adding?

But in case of ptr = memory - ((unsigned int)*ptr), it is 0x00000001 which is
promoted to 0x00000000_00000001 and substracted?


More information about the Gcc-bugs mailing list