[fpc-devel] Compiling trunk on OS X

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Feb 1 23:42:07 CET 2014


On 01 Feb 2014, at 23:34, Florian Klämpfl wrote:

> Am 01.02.2014 23:29, schrieb Jonas Maebe:
>> 
>> I can reproduce it. The problem does not happen when starting the
>> make all with an x86-64 compiler, nor when disabling optimizations.
>> So it seems like it's a bug in the i386 code generator or optimizer
>> that causes a bug in the x86-64 cross-compiler, which in turn causes
>> the generated native x86-64 compiler to be buggy. I guess the change
>> in r26222 somehow manages to trigger that bug... These are some of
>> the worst kind of things to debug :/
> 
> It might be worth to diff the assembler generated by the cross compiler
> and ppc2?

Yes, I got the same idea :) It seems the cross-compiled compiler is in fact assuming that it's generating Win64 SEH code for Darwin/x86-64 after that change:

--- compiler.s  2014-02-01 23:32:11.000000000 +0100
+++ ../snew/compiler.s  2014-02-01 23:34:31.000000000 +0100
@@ -118,11 +118,11 @@
        .align 3
 .globl _COMPILER_$$_COMPILE$ANSISTRING$$LONGINT
 _COMPILER_$$_COMPILE$ANSISTRING$$LONGINT:
...
-# [240] try
-       leaq    232(%rsp),%rdx
-       leaq    256(%rsp),%rsi
-       movl    $1,%edi
-       call    FPC_PUSHEXCEPTADDR
-       movq    %rax,%rdi
-       call    FPC_SETJMP
-       movq    %rax,320(%rsp)
-       testl   %eax,%eax
-       jne     Lj37
 # [241] ExceptionMask:=GetExceptionMask;
...
        movq    $0,%rdx
        movl    $1023,%edi
        call    _VERBOSE_$$_MESSAGE1$LONGINT$ANSISTRING$TMSGQUEUEEVENT
-Lj346:
-Lj133:
-Lj37:
-       call    FPC_POPADDRSTACK
-# [294] DoneCompiler;
-       call    _COMPILER_$$_DONECOMPILER
-# [296] SetExceptionMask(ExceptionMask);
-       movl    120(%rsp),%edi
-       call    _MATH_$$_SETEXCEPTIONMASK$TFPUEXCEPTIONMASK$$TFPUEXCEPTIONMASK
-       movq    320(%rsp),%rax
-       testq   %rax,%rax
-       je      Lj38
-       call    FPC_RERAISE
-Lj38:
+Lj343:
+Lj130:
 # [298] DoneVerbose;

> Maybe I should get once a Mac for testing as well :)

Maybe Karl-Michael Schindler can give you remote access to his iMac?


Jonas


More information about the fpc-devel mailing list