[fpc-pascal] Re:LongWord
Carsten Bager
carsten at beas.dk
Tue May 8 08:46:00 CEST 2007
> 10 - 5 = 5
> This is a different issue; 10-5 should not overflow regardless of the
> type that is used for the calculation.
> Daniƫl
I tried to compile and run with the
2.1.3 compiler (arm and i386)
Both executables did run without runtime errors but the compilers gave a
warning.
The same program compiled with a Delphi7 Compiler does not give any
warnings or errors.
Carsten
--------------------------- Arm Compiler output ------------------------------
linux-bh36:/Fpc/Pas/Linux/Test/Word32 # ./makearm.sh
+---------------------------------+
| CFG file ver. 1.00 d. 19/9-2006 |
+---------------------------------+
+---------------------------------+
| Cross compiling for ARM 9 Linux |
+---------------------------------+
+--------------+
| Standard lib |
+--------------+
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.1.3 [2007/03/22] for arm
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for ARM
Compiling word32test.pp
word32test.pp(17,12) Warning: Type size mismatch, possible loss of data /
range check error
Assembling word32test
Assembling with smartlinking word32test
/Fpc/ArmBin/ar: creating libpword32test.a
Linking word32test
19 lines compiled, 1.1 sec
1 warning(s) issued
2 hint(s) issued
-------------------- I386 Compiler Output ----------------------------------------
linux-bh36:/Fpc/Pas/Linux/Test/Word32 # ./make386.sh
+---------------------------------+
| CFG file ver. 1.00 d. 19/9-2006 |
+---------------------------------+
+--------------------------+
| Compiling for I386 Linux |
+--------------------------+
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.1.3 [2007/03/22] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling word32test.pp
word32test.pp(17,12) Warning: Type size mismatch, possible loss of data /
range check error
Linking word32test
19 lines compiled, 0.3 sec
1 warning(s) issued
2 hint(s) issued
--------- The Program -----------------------------------------
program word32test;
{$RANGECHECKS ON}
{$OVERFLOWCHECKS ON}
{$S+ STACK CHECKING ON}
{$TYPEINFO ON}
{$LONGSTRINGS OFF}
var
a,b,c:longWord;
Begin
a:=10;
b:=5;
writeLn('a=',a,' b=',b);
c:= a - b;
writeLn('Resultat : ',c);
End.
More information about the fpc-pascal
mailing list