~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/tests/tbs/tb0267.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{ %CPU=i386 }
 
2
{ Old file: tbs0309.pp }
 
3
{ problem with ATT assembler written by bin writer     OK 0.99.14 (PFV) }
 
4
 
 
5
{ This code was first written by Florian
 
6
  to test the GDB output for FPU
 
7
  he thought first that FPU output was wrong
 
8
  but in fact it is a bug in FPC :( }
 
9
program bug0309;
 
10
 
 
11
var
 
12
   a,b : double;
 
13
   _as,bs : single;
 
14
   al,bl : extended;
 
15
   aw,bw : integer;
 
16
   ai,bi : longint;
 
17
   ac : comp;
 
18
begin
 
19
{$ifdef CPU86}
 
20
{$asmmode att}
 
21
   asm
 
22
      fninit;
 
23
   end;
 
24
   a:=1;
 
25
   b:=2;
 
26
   asm
 
27
      movl  $1,%eax
 
28
      fldl  a
 
29
      fldl  b
 
30
      faddp %st,%st(1)
 
31
      fstpl a
 
32
   end;
 
33
   { the above generates wrong code in binary writer
 
34
     fldl is replaced by flds !!
 
35
     if using -alt option to force assembler output
 
36
     all works correctly PM }
 
37
   writeln('a = ',a,' should be 3');
 
38
   if a<>3.0 then
 
39
     Halt(1);
 
40
   a:=1.0;
 
41
   a:=a+b;
 
42
   writeln('a = ',a,' should be 3');
 
43
   _as:=0;
 
44
   al:=0;
 
45
   asm
 
46
     fldl a
 
47
     fsts _as
 
48
     fstpt al
 
49
   end;
 
50
   if (_as<>3.0) or (al<>3.0) then
 
51
     Halt(1);
 
52
   ai:=5;
 
53
   bi:=5;
 
54
   asm
 
55
     fildl ai
 
56
     fstpl a
 
57
   end;
 
58
   if a<>5.0 then
 
59
     Halt(1);
 
60
 
 
61
   ac:=5;
 
62
   asm
 
63
     fildl ai
 
64
     fstpl a
 
65
   end;
 
66
   if a<>5.0 then
 
67
     Halt(1);
 
68
   aw:=-4;
 
69
   bw:=45;
 
70
   asm
 
71
     fildw aw
 
72
     fstpl a
 
73
   end;
 
74
   if a<>-4.0 then
 
75
     Halt(1);
 
76
   ac:=345;
 
77
   asm
 
78
     fildq ac
 
79
     fstpl a
 
80
   end;
 
81
   if a<>345.0 then
 
82
     Halt(1);
 
83
 
 
84
{$endif CPU86}
 
85
end.