G:\WinFBE_Suite\FreeBASIC-1.06.0\fbc64 -w all -asm intel -gen gcc -Wc -O2 -v "%f"
Code: Select all
type clongdouble
__(0 to 1) as ulongint
end type
function pild() as clongdouble
dim as clongdouble result
asm
fldpi
fstp tbyte ptr [result]
end asm
function = result
end function
dim as clongdouble x, y, z
x=pild()
print hex(x.__(0)), hex(x.__(1))
however, when using -asm att on the equivalent code, it compiles and runs ok when using the afore mentioned versions of gcc
G:\WinFBE_Suite\FreeBASIC-1.06.0\fbc64 -w all -asm att -gen gcc -Wc -O2 -v "%f"
Code: Select all
type clongdouble
__(0 to 1) as ulongint
end type
function pild() as clongdouble
dim as clongdouble result
asm
"fldpi \n" _
"fstpt %[RESULT$1] \n" _
:[result]"=m"(result) _
: _
:
end asm
function = result
end function
dim as clongdouble x, y, z
x=pild()
print hex(x.__(0)), hex(x.__(1))
so I suspect that there's bug in fbc, when translating intel asm to gcc inline asm