Igor Marnat wrote:
Anyway, I cannot execute simple program built with my new compiler. Program looks like:
program test;
type MyRecord = record x: word; y: word; end;
var t1, t2: MyRecord;
begin writeln ('SizeOf (word)', Sizeof (word)); writeln ('SizeOf (longword)', Sizeof (longword)); writeln ('SizeOf (CInteger)', Sizeof (CInteger)); t1.x := 1; t1.y := 1; writeln ('before assignment'); t2 := t1; writeln ('after assignment'); end.
Program output:
bash-2.05b# ./test SizeOf (word)4 SizeOf (longword)8 SizeOf (CInteger)4 before assignment Illegal instruction
When I change type of fields fo MyRecord to longword, it works fine. Is it anything wrong with alignment or packed records? But my record isn't packed ... I could avoid usage of whole records assignments and assign the values field by field but there are two reason why I don't want to do that:
- it shows that something is wrong, isn't it?
- assignment of the whole records is used in crt.pas unit, for example, in
function ScreenSize of crt.pas unit which return the value of TPoint type which is record (this assignment doesn't work as well). I really don't want change anything in crt.pas unit:).
Please, any ideas or hints ...
Use gpc -S -fverbose-asm to find out offending instructions. I have tried your program on MacOS cross-compiler, it seems to use floating point double moves for whole record assignment, maybe this is the problem?
BTW there is quite a lot of different Power and PowerPC chips, so maybe you need to tell gpc to generate code for your processor?