Looks like a general RTL issue, I see this on POWER, RV64 and ARM64 (the latter two on godbolt). [tkoenig@gcc135 ~]$ cat c.c long foo (long b, long c) { return b + c - 1; } [tkoenig@gcc135 ~]$ gcc -O3 -S c.c [tkoenig@gcc135 ~]$ cat c.s .file "c.c" .machine power8 .abiversion 2 .section ".text" .align 2 .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc add 3,3,4 addi 3,3,-1 blr .long 0 .byte 0,0,0,0,0,0,0,0 .cfi_endproc .LFE0: .size foo,.-foo .ident "GCC: (GNU) 13.0.1 20230215 (experimental)" .section .note.GNU-stack,"",@progbits This should be addi 3,4,-1 ret
How could it? addi 3,4,-1 blr would be return c - 1; rather than return b + c - 1;
Urgh,too late in the evening, I guess. Sorry for the noise.