[fpc-pascal] Severe bug (?) dividing comp variables in 3.0.0

Bart bartjunk64 at gmail.com
Wed Jun 29 21:16:43 CEST 2016


On 6/29/16, greim <greim at schleibinger.com> wrote:
> Hi,
>
> there seems to be a very strange effect with dividing comp variables in
> 3.0.0:
>
> Dividing a comp variable x by any number which is not 1 or x gives result
> 0.
>

Win7-64, 32-bit fpc/delphi:

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>dcc32
compbug300.lpr
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
compbug300.lpr(25)
26 lines, 0.06 seconds, 12292 bytes code, 1861 bytes data.

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>compbug300
x1 : 8.0000
x2 = x1/2 should be 4 but is : 4.0000
x2 = x1/4 should be 2 but is : 2.0000
x2 = x1/8.0 should be 1 and is : 1.0000

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>fpc compbug300.lpr
Free Pascal Compiler version 3.0.0 [2015/11/16] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling compbug300.lpr
compbug300.lpr(20,10) Warning: Automatic type conversion from floating type to C
OMP which is an integer type
Linking compbug300.exe
24 lines compiled, 0.1 sec, 34800 bytes code, 2436 bytes data
1 warning(s) issued

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>compbug300
x1 : 8.0000
x2 = x1/2 should be 4 but is : 0.0000
x2 = x1/4 should be 2 but is : 0.0000
x2 = x1/8.0 should be 1 and is : 1.0000

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>fpc compbug300.lpr
Free Pascal Compiler version 2.6.4 [2014/03/06] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling compbug300.lpr
compbug300.lpr(20,10) Warning: Automatic type conversion from floating type to C
OMP which is an integer type
Linking compbug300.exe
24 lines compiled, 0.7 sec , 30816 bytes code, 1932 bytes data
1 warning(s) issued

C:\Users\Bart\LazarusProjecten\ConsoleProjecten\bugs\compdiv>compbug300
x1 : 8.0000
x2 = x1/2 should be 4 but is : 4.0000
x2 = x1/4 should be 2 but is : 2.0000
x2 = x1/8.0 should be 1 and is : 1.0000

Bart



More information about the fpc-pascal mailing list