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

wkitty42 at windstream.net wkitty42 at windstream.net
Wed Jun 29 21:03:57 CEST 2016


On 06/29/2016 10:56 AM, greim 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.
>
> Tested on a i386 machine.
>
> It works fine with for example with fpc 2.6.4.
> I know I can use int64 instead, but we have a lot of very old, but reliable,
> code around.
>
> Example below.

i see the same using your code on x86_64 linux...

Free Pascal Compiler version 3.0.1 [2016/06/29] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling compbug300.pas
compbug300.pas(59,10) Warning: Automatic type conversion from floating type to 
COMP which is an integer type
Linking compbug300
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
68 lines compiled, 0.1 sec
1 warning(s) issued

2016 Jun 29  15:00:57 -0400
myuser at mymachine:~/development/projects/misc$ ./compbug300
x1 :  8.000000000000000000E+0000
x2 = x1/2 should be 4 but is :  0.000000000000000000E+0000
x2 = x1/4 should be 2 but is :  0.000000000000000000E+0000
x2 = x1/8.0 should be 1 and is :  1.000000000000000000E+0000


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list* unless
        private contact is specifically requested and granted.



More information about the fpc-pascal mailing list