Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-02

Int64 multiplication error

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bogdan

Hello

I have a problem with int64 multiplication:

program tstint64;
{$MODE objfpc} {$H+}
uses SysUtils;
var
   i: integer;
   y: int64;
begin
   y := 1;
   for i := 1 to 10 do
   begin
     writeln (i, ' y=', IntToHex(y,16));
     y := y * 10;
   end;
end.

The program is compiled with crosscompiler on Windows7 for ARM Xscale-IXP43X (Linux 2.6, big endian)
After downloading to device UC-8410, I get:

./tstint64
1 y=0000000000000001
2 y=0000000A00000000
3 y=0000000000000064
4 y=000003E800000000
5 y=0000000000002710
6 y=000186A000000000
7 y=00000000000F4240
8 y=0098968000000000
9 y=0000000005F5E100
10 y=3B9ACA0000000000

HI and LO dwords are swaped in every second line.

The crosscompiler for Windows host is made from FPC 2.6.0 /tags/release_2_6_0 revision 20381 with:
c:\FPC\2.6.0\bin\i386-win32\make.exe all CPU_TARGET=armeb OS_TARGET=linux BINUTILSPREFIX=armeb-linux- FPC=ppc386.exe OPT="-dFPC_ARMEB" CROSSOPT="-dFPC_ARMEB -Cb -CfSOFT -Cparmv4"

With previous version of crosscompiler I was using (FPC 2.4.2), there was no such error. Previous version of crosscompiler was compiled with CROSSOPT -CparmV5,
but with FPC.2.6.0 I get a lot of "Warning: Arm BLX instruction targets Arm function".

I think something is wrong with crosscompiler.

Bogdan