[fpc-pascal] program crash when -Cfsse2 enabled

code dz mr.cefou at gmail.com
Mon Aug 14 13:06:52 CEST 2017


Hi
this is a portion of the program , when i add -Cfsse2 it crashes.
but works ok without sse2
//////////////////////////////////////
program demo;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
uses math;
const XRES = 1280;
const YRES = 720;
var myLut  : array[0..XRES*YRES-1] of longword;

procedure initLut;
var i,j : longint;
var x,y,w,r,a,u,v : single;
var iu,iv,iw : int32;
begin
 for j:=0 to YRES -1 do
    for i:=0 to XRES -1 do
    begin
        x := -1.0 + i*(2.0/XRES);
        y :=  1.0 - j*(2.0/YRES);
        r := sqrt( x*x+y*y );
        a := arctan2( y, x );

        u := 1.0/r;
        v := a*(3.0/3.14159);
        w := r*r;
        if( w>1.0  ) then w := 1.0;

        iu := round(u*255.0);
        iv := round(v*255.0);
        iw := round(w*255.0);

        myLut[XRES*j+i] := ((iw and 255)<<16) or ((iv and 255)<<8) or
(iu and 255);
    end;
end;
begin	
    initLut;
    readln;
end.

/////////////////////////////////////



More information about the fpc-pascal mailing list