[fpc-devel] crash with -gt -O2 (regvar) in trunk

Martin fpc at mfriebe.de
Mon Jun 7 18:40:19 CEST 2010


On 06/06/2010 20:44, Martin wrote:
> It seems it is RegVar ( and -gt )
>
>   -gh -gt -g  -gl  -gw -godwarfsets    -CX -XX -Xs   -O2  -OpPENTIUMM  
> -Oonoregvar
>   -gh -gt -g  -gl  -gw -godwarfsets    -CX -XX -Xs   -O2  -OpPENTIUMM
>
> the first one, works fine, the 2nd causes the crash.

I have no idea if the following is relevant.
  Compiling the same unit with/without -gt / both times with -O2 leads 
to some difference in the order registers are used.

In the example below this is probably not relevant => I wonder  if in 
other cases it could be relevant.

.section .text.n_buttons_tcustombitbtn_$__realizekind
     .balign 16,0x90
     .balign 16,0x90
.globl    BUTTONS_TCUSTOMBITBTN_$__REALIZEKIND
BUTTONS_TCUSTOMBITBTN_$__REALIZEKIND:

* WITH -gt has the following extra lines (of course, since it does the 
random intialize)
.Ll205:
     movb    $85,-64(%ebp)
     movb    $85,-4(%ebp)
     movl    $0,%esi
     movl    $1431655765,-8(%ebp)
     movl    $1431655765,-12(%ebp)

* I noted neiter eax nor edx are in this code => so I wonder if they 
should be affected later on?

then they share the SAME code
     movl    $0,-56(%ebp)
     leal    -24(%ebp),%ecx
     leal    -48(%ebp),%edx
     movl    $1,%eax
     call    FPC_PUSHEXCEPTADDR
     call    FPC_SETJMP
     pushl    %eax
     testl    %eax,%eax
     jne    .Lj494

** and then:

**** with -gt
.Ll206:
# [185] if (Kind <> bkCustom) then
     movl    -60(%ebp),%eax
     movl    852(%eax),%edx
     testl    %edx,%edx
     je    .Lj498

**** without -gt
.Ll194:
# [185] if (Kind <> bkCustom) then
     movl    -60(%ebp),%edx
     movl    852(%edx),%eax
     testl    %eax,%eax
     je    .Lj498

==> eax and adx have just been swapped.

In this case the result should be the same, and since both cases are 
using both registers, the 2 registers should in both cases be avail for 
usage.

I wonder if in other cases, eax may drop in for edx (or vice versa) 
where it may cause a proble (data replaced?)

The question is, should -gt have caused this change?





More information about the fpc-devel mailing list