Please see attached log file I copied from the assembler window.  I am yet to 
test this on windows.

Thanks,
Shannon

在 六, 12月 29, 2012 at 1:26 下午,leledumbo <[email protected]> 写道:
> The Assembler shows that @lib and @lib[0] are exactly same thing. 

The following program shows that they are NOT the same 

#!/usr/bin/instantfpc 
var 
a1: array of Integer; 
begin 
setlength(a1,1); 
writeln(ptruint(@a1)); 
writeln(ptruint(@a1[0])); 
end. 

output: 
$ chmod +x test.pas 
$ ./test.pas 
134651632 
3077795880 



-- 
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-SEGFAULT-difference-between-pointer-and-dynarray-tp4028296p4028303.html
 
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. 

-- 
_______________________________________________ 
Lazarus mailing list 
[email protected] 
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 

== CASE 1: SIGSEGV @ callq 0x4e01d8 
==================================================================
    procedure luaL_newlib(L: Plua_State; lr: array of luaL_Reg);
    begin
856   luaL_newlibtable(L, lr);
857   luaL_setfuncs(L, @lr, 0);
      //luaL_setfuncs(L, lr, 0);
859 end;
------------------------------------------------------------------------------------------------------
lua52.pas:856           luaL_newlibtable(L, lr);
4E0364 488b55e8         mov    -0x18(%rbp),%rdx
4E0368 488b75f0         mov    -0x10(%rbp),%rsi
4E036C 488b7df8         mov    -0x8(%rbp),%rdi
4E0370 e8e3feffff       callq  0x4e0258 <LUAL_NEWLIBTABLE>
lua52.pas:857           luaL_setfuncs(L, @lr, 0);
4E0375 488b75f0         mov    -0x10(%rbp),%rsi
4E0379 488b7df8         mov    -0x8(%rbp),%rdi
4E037D ba00000000       mov    $0x0,%edx
4E0382 e851feffff       callq  0x4e01d8 
<LUA52_LUAL_SETFUNCS$POINTER$PLUAL_REG$LONGINT>  <--
lua52.pas:859           end;

== CASE 2: SIGSEGV @ callq 0x4e01d8 
==================================================================
    procedure luaL_newlib(L: Plua_State; lr: array of luaL_Reg);
    begin
856   luaL_newlibtable(L, lr);
857   luaL_setfuncs(L, @lr[0], 0);
      //luaL_setfuncs(L, lr, 0);
859 end;
------------------------------------------------------------------------------------------------------
lua52.pas:856           luaL_newlibtable(L, lr);
4E0364 488b55e8         mov    -0x18(%rbp),%rdx
4E0368 488b75f0         mov    -0x10(%rbp),%rsi
4E036C 488b7df8         mov    -0x8(%rbp),%rdi
4E0370 e8e3feffff       callq  0x4e0258 <LUAL_NEWLIBTABLE>
lua52.pas:857           luaL_setfuncs(L, @lr[0], 0);
4E0375 488b75f0         mov    -0x10(%rbp),%rsi
4E0379 488b7df8         mov    -0x8(%rbp),%rdi
4E037D ba00000000       mov    $0x0,%edx
4E0382 e851feffff       callq  0x4e01d8 
<LUA52_LUAL_SETFUNCS$POINTER$PLUAL_REG$LONGINT>  <--
lua52.pas:859           end;

== CASE 3: NO ERROR 
==================================================================================
    procedure luaL_newlib(L: Plua_State; lr: array of luaL_Reg);
    begin
856   luaL_newlibtable(L, lr);
      // luaL_setfuncs(L, @lr, 0);
858   luaL_setfuncs(L, lr, 0);
859 end;
------------------------------------------------------------------------------------------------------
lua52.pas:856           luaL_newlibtable(L, lr);
4E0364 488b55e8         mov    -0x18(%rbp),%rdx
4E0368 488b75f0         mov    -0x10(%rbp),%rsi
4E036C 488b7df8         mov    -0x8(%rbp),%rdi
4E0370 e8e3feffff       callq  0x4e0258 <LUAL_NEWLIBTABLE>
lua52.pas:858           luaL_setfuncs(L, lr, 0);
4E0375 488b55e8         mov    -0x18(%rbp),%rdx
4E0379 488b75f0         mov    -0x10(%rbp),%rsi
4E037D 488b7df8         mov    -0x8(%rbp),%rdi
4E0381 b900000000       mov    $0x0,%ecx
4E0386 e855feffff       callq  0x4e01e0 <LUAL_SETFUNCS>
lua52.pas:859           end;
------------------------------------------------------------------------------------------------------
830 procedure luaL_setfuncs(L: Plua_State; lr: PluaL_Reg; nup: Integer); cdecl; 
external LUA_LIB_NAME;

    procedure luaL_setfuncs(L: Plua_State; lr: array of luaL_Reg; nup: Integer);
    begin
834   luaL_setfuncs(L, @lr, nup);
835 end;
------------------------------------------------------------------------------------------------------
lua52.pas:834           luaL_setfuncs(L, @lr, nup);
4E022F 488b75f0         mov    -0x10(%rbp),%rsi
4E0233 8b55e8           mov    -0x18(%rbp),%edx
4E0236 488b7df8         mov    -0x8(%rbp),%rdi
4E023A e899ffffff       callq  0x4e01d8 
<LUA52_LUAL_SETFUNCS$POINTER$PLUAL_REG$LONGINT>
lua52.pas:835           end;

======================================================================================================

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to