Paul Eggert wrote: > > I can't determine whether it's a GCC or a QEMU bug. > > Surely it is a QEMU bug, as QEMU isn't properly implementing the > z/Architecture Principles of Operation (POP).
Thanks; I didn't know about this document. > Page 7-25 of the current > edition (SA22-7832-12) says that the AGR instruction treats its operands > as 64-bit signed binary integers, and sets condition code 3 (the > overflow flag) if the result overflows. You can get a copy of the POP > here (requires registration): > > https://www.ibm.com/support/pages/zarchitecture-principles-operation The previous edition (available without registration at http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr011.pdf ) says the same thing. > The patch you submitted to QEMU looks reasonable. However, there are > similar bugs in cc_calc_sub_32 and cc_calc_sub_64 that should also be > fixed. Oh, indeed! I had looked at these functions and did not see the bug. Reported at https://gitlab.com/qemu-project/qemu/-/issues/618 . Bruno