On 9/12/21 8:28 AM, Bruno Haible 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). 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 QEMU bug hypothesis
looks more probable to me, so I've opened this ticket:
https://gitlab.com/qemu-project/qemu/-/issues/616

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. I attempted to submit a comment to that effect on the gitlab.com website but couldn't easily figure out how to make commenting work there.

Reply via email to