gmp 4.3.0 tests fail on Mac OS X 10.5

Torbjorn Granlund tg at
Wed May 6 18:50:07 CEST 2009

Mark Rodenkirch <mgrogue at> writes:

  This should be no surprise, but I suspect it to be a compiler bug.  In
  looking at the snippet of code from the files provided:
  0000003c	addl	(%esp),%eax
  0000003f	ret
  00000040	sbbl	%eax,%eax
  00000042	negl	%eax
  00000044	popl	%ebx
  00000045	popl	%esi
  00000046	popl	%edi
  00000047	ret
  00000048	nopl	0x00000000(%eax,%eax)
  00000050	jcxz	0x00000040
Funny, jecxz displays as jcxz, which is not right.  (But it dislays
incorrectly also with my older Xcode tools, for known-good objecct code,
so I suspect it is just a disassembler bug.)

  The jcxz instruction (offset 50) is actually jumping to offset 3f, not
  offset 40.  It is returning from the routine without restoring

Either the hardware is wrong, or *both* the assembler and disassembler
are broken and get the offset wrong.  I don't know if there is a better
disassembler available; otool makes it difficult to check if the offset
is wrong (which I strongly suspect).

I got a crazy idea: Perhaps the .Lfoo labels confuses Apple's programs.
(We really should use L(foo) in the GMP assembly, to make the labels
more short-lived.)

Please try this patch:

diff -r bcf4178f4ccc mpn/x86/p6/aors_n.asm
--- a/mpn/x86/p6/aors_n.asm	Wed May 06 14:13:24 2009 +0200
+++ b/mpn/x86/p6/aors_n.asm	Wed May 06 18:44:18 2009 +0200
@@ -90,7 +90,7 @@
 	sbb	%eax, %eax
 	neg	%eax
 	pop	%ebx
@@ -99,8 +99,8 @@
-	jecxz	.Lend
+	jecxz	L(end)
 Zdisp(	mov,	0,(up,n,4), %eax)
 Zdisp(	ADCSBB,	0,(vp,n,4), %eax)
@@ -135,7 +135,7 @@
 	mov	%edx, 28(rp,n,4)
 	lea	8(n), n
-	jmp	.Loop
+	jmp	L(top)


More information about the gmp-bugs mailing list