SIGSEGV in compiler generated code
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
for this code:
function TFPReaderPNG.ColorColorAlpha16 (CD:TColorData) : TFPColor;
var c : qword;
begin
with result do
begin
red := CD and $FFFF;
c := qword($FFFF0000);
green := (CD and c) shr 16;
c := c shl 16;
blue := (CD and c) shr 32;
c := c shl 16;
alpha := (CD and c) shr 48;
end;
end;
the compiler generate the following section of assembler:
Dump of assembler code for function TFPREADERPNG__COLORCOLORALPHA16:
$08144224 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+0>: push %ebp
$08144225 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+1>: mov %esp,%ebp
$08144227 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+3>: sub $0x10,%esp
$0814422a &LtPos;TFPREADERPNG__COLORCOLORALPHA16+6>: mov %eax,0xfffffffc(%ebp)
$0814422d &LtPos;TFPREADERPNG__COLORCOLORALPHA16+9>: mov %edx,0xfffffff8(%ebp)
// eax := CD;
$08144230 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+12>: mov 0x8(%ebp),%eax
// eax := eax and $FFFF;
$08144233 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+15>: and $0xffff,%eax
// !!!!!!!!!!!!!!!!!!!!!!!!!
// edx := @result?, why 0x0?
// 0x0^:= %ax, why %ax, should it be %eax?
//
$08144238 &LtPos;TFPREADERPNG__COLORCOLORALPHA16+20>: mov $0x0,%edx
$0814423d &LtPos;TFPREADERPNG__COLORCOLORALPHA16+25>: mov %ax,(%edx)
Additional information:
Reporter: Jesus Reyes Aguilar
EMail: jesusrmx at yahoo dot com dot mx
Mantis conversion info:
- Mantis ID: 6156
- OS: Linux
- Fixed in version: 2.0.2