bug0309.pp 604 B

12345678910111213141516171819202122232425262728293031
  1. { This code was first written by Florian
  2. to test the GDB output for FPU
  3. he thought first that FPU output was wrong
  4. but in fact it is a bug in FPC :( }
  5. program bug0309;
  6. var
  7. a,b : double;
  8. begin
  9. asm
  10. fninit;
  11. end;
  12. a:=1;
  13. b:=2;
  14. asm
  15. movl $1,%eax
  16. fldl a
  17. fldl b
  18. fadd
  19. fstpl a
  20. end;
  21. { the above generates wrong code in binary writer
  22. fldl is replaced by flds !!
  23. if using -alt option to force assembler output
  24. all works correctly PM }
  25. writeln('a = ',a,' should be 3');
  26. a:=1.0;
  27. a:=a+b;
  28. writeln('a = ',a,' should be 3');
  29. end.