[PATCH] Fix typo in z13 bdiv_dbm1c.

marco.bodrato at tutanota.com marco.bodrato at tutanota.com
Thu Oct 12 18:33:55 CEST 2023


10 ott 2023, 09:14 da tg at gmplib.org:

> Stefan Liebler <stli at linux.ibm.com> writes:
>  In my case, before calling mpn_divexact_by3c v6 was {0x1, 0x0} and thus 

> OK.  We should clearly have tests/*call.asm and tests/*check.c for
> s390_64 and s390_32.  (But the check file might want to re-randomise the
> magic register values after checking them.)

Another approach, simpler in my opinion, is to write a test checking the return value of the function mpn_divexact_by3c. The manual documents that the "return value c satisfy c*b^n + a-i = 3*q, where...", exactly, so we should test the return value.

In the library we have some ASSERTs, checking if the return value is zero or not, but I believe we do not have any place where the correct return value is really checked.

Does the attached test detect the suspicious code?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: t-dive.c
Type: text/x-csrc
Size: 3025 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20231012/8d6d732e/attachment.bin>

More information about the gmp-devel mailing list