[fpc-devel] Variant compiling errors

petr.kristan at epos.cz petr.kristan at epos.cz
Mon Oct 10 14:00:48 CEST 2005


Hi.

After a few hours with gdb was isolated errors and strangeness in compiler 
at work with variants:

Example:

function c(const vv:  variant): variant;
begin
  result := vv;
end;

function b(vv:  variant): variant;
begin
  result := vv;
end;

function a(var vv:  variant): variant;
begin
  result := vv;
end;

procedure start;
var
  v, v1: Variant;
begin
  v := VarArrayCreate([0, 0], varVariant);

  a(v); 
  //if variant result of a() isn't assigned, fpc_finalize() at end of a(v)
  //destroys temporary result. But when start() ends fpc_finalize() tryes
  //to destroy it again

  b(v);
  //if b() is called then variant param is copied but not whole (deeply), vv.varray
  //points to the same place as v.array. At end of b(v) is pointer
  //vv.array destroyed by fpc_decref() and then v.array points to the
  //destroyed memory

  c(v);
  //At the start of func c() is v copied to the vv deeply but i think
  //that behaviour of "var" and "const" calling should be the same (by
  //reference) not vy value like c()
end;

I try to understand compiler code and repair it, but this is "very long
distance race". But like I see the responses to my previous reports
(absolutely no interest), this will be fastest solution :(. Really here
isn't anybody who understand to compiler code and help me with repair?
Or is anywhere another e-mail list or another comunication channel where
i can talk about this problem?

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



More information about the fpc-devel mailing list