Sign in Join

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

Mailing lists / fpc-devel / 2008-07

Optimization -O2 on Linux AMD64

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Unknown author

Hi.

Today i was hunting malicious error.

System: AMD64 Linux, fpc from svn rev 11355.

program o2;
uses
  sysutils;
function MSecsToTimeStamp(MSecs: comp): TTimeStamp;
begin
  result.Date := Trunc(msecs / msecsperday);
  msecs:= msecs-comp(result.date)*msecsperday;
  writeln(result.Date); //732067
  result.Time := Round(MSecs);
  writeln(result.Date); //0
end ;
begin
  MSecsToTimeStamp(63250588800000);
end.

Compiled with optimization: fpc -S2 -O2 o2.pas
Result is:
732067
0
and should be
732067
732067

This occurs only on Linux AMD64. Linux i386, win32 and win64 is ok.

Problem is, that rtl (sysutils) is compiled with -O2 implicitly.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email