68000 issue in longlong.h

Torbjörn Granlund tg at gmplib.org
Wed Mar 3 13:13:03 UTC 2021


"selco at t-online.de" <selco at t-online.de> writes:

  Hello,
  I am compiling and testing libgmp for AmigaOS. Yes, I am crazy.
   
  I use<https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz>
  Thanks to bebbo's gcc https://github.com/bebbo/amiga-gcc 
  <https://github.com/bebbo/amiga-gcc> I was quite successful. I had some 
  issues in the tests hovever.
  For instance t-conv, t-sqrt and t-sqrt_ui failed. The bugs disappeared when 
  I compiled without optimization and appeared when I used -O2, so I 
  suspected a compiler bug and reported that to the Amiga gcc6 maintainer. He 
  looked after the problem and found an issue inside libgmp's code.
   
  The bug is inside gmp's header longlong.h:1220, where asm for 68000 is 
  defined:
   
  wrong code:
  ...
  " | End inlined umul_ppmm" \
  : "=&d" (xh), "=&d" (xl), \
  "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
  : "%2" ((USItype)(a)), "d" ((USItype)(b))); \
   
  correction:
  ...
  " | End inlined umul_ppmm" \
  : "=&d" (xh), "=&d" (xl), \
  "=&d" (__umul_tmp1), "=&d" (__umul_tmp2) \        <---  an & must be added 
  after the =
  : "%2" ((USItype)(a)), "d" ((USItype)(b))); \
   
The current code looks correct to me.  Please explain why you think it
is not correct.


-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list