[fpc-pascal] Bus error on ARM-WinCE crosscompiler FPC 2.3.1

Bogdan bogdan.vuk at siol.net
Mon Sep 14 20:39:38 CEST 2009


Hi

If I crosscompile the folowing program with
Lazarus-0.9.29-21694-fpc-2.3.1-20090914-win32.exe and
Lazarus-0.9.29-21694-fpc-2.3.1-20090914-cross-arm-wince-win32.exe:

program test4;

{$MODE Delphi}
{$APPTYPE CONSOLE}

uses
{$IFDEF WINDOWS} Windows, {$ENDIF}
  SysUtils, Classes, DateUtils;

{$IFDEF WINDOWS} {$R test4.rc} {$ENDIF}

function cvt1 (t: TdateTime): string;
var yy,mm,dd,hh,nn,ss,ms: Word;
begin
  DecodeDateTime (t,yy,mm,dd,hh,nn,ss,ms);
  result := Format('%d %d %d %d %d %d %d',[yy,mm,dd,hh,nn,ss,ms]);   // <<<<< Bus error or misaligned data access ????
end;

function cvt2 (t: TdateTime): string;
var yy,mm,dd,hh,nn,ss,ms: Word;
begin
  DecodeDateTime (t,yy,mm,dd,hh,nn,ss,ms);
  try
    result := Format('%d %d %d %d %d %d %d',[yy,mm,dd,hh,nn,ss,ms]);  // OK, no Bus Error 
  except
    on E: Exception do writeln ('cvt2 ERROR ' + E.Message);
  end;
end;


begin
  try
    writeln ('cvt1: Now = ' + cvt1(Now));
  except
    on E: Exception do writeln ('cvt1 ERROR ' + E.Message);
  end;

  writeln ('cvt2: Now = ' + cvt2(Now));
end.

and download to ARM (Advantech UNO-1019, WinCE 5.0) the output from program is:

  cvt1 ERROR Bus error or misaligned data access
  cvt2: Now = 2009 9 14 12 55 31 0


Crosscompiling with 2.2.4   Lazarus-0.9.29-21694-fpc-2.2.4-20090914-win32.exe and
Lazarus-0.9.29-21694-fpc-2.2.4-20090914-cross-arm-wince-win32.exe is OK:

  cvt1: Now = 2009 9 14 13 20 11 0
  cvt2: Now = 2009 9 14 13 20 11 0


Is this Bus error a compiler bug or something else ?

Regards .

Bogdan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090914/b1c23717/attachment.html>


More information about the fpc-pascal mailing list