The bug in Turbo C 2.0

Liang Chii chii at ee.su.oz.au
Thu Mar 15 03:46:20 AEST 1990


Hi, net reader,

I found a bug in Turbo C, please reconfirm if it is truely a bug.
======= cut here =======
#include <stdio.h>
#include <alloc.h>

main() {
float far *temp, fix;
int i;

temp = farmalloc(40);
for(i = 0; i< 5; i++)
scanf("%f", temp+i);
}
===== end here ======

The above code does not work but with an error message :
"floating point formats not linked"

But, if we put another statement at the end of the program :

scanf("%f", &fix);

Now, re-compiler and link the code.  It works ok.
It is very obvious that the code "scanf("%f", &fix);" should not
affect the about program like this.  I believe there is a bug
between farmalloc(farcalloc) and scanf("%f",...).

That is what I found.

==========================================================================
YungChii Liang, Power Electronics and Drives Group 
                School of Electrical Engg., University of Sydney
                NSW 2006, Australia
                TEL: 02 692 2337  FAX: 02 692 3847
e-mail : chii at ee.su.oz.au                       oo 
         chii at facet.ee.su.oz              ^-^  o   The man from Formosa 
         chii at extro.ucc.su.oz.au         (o o)
                                           ~       



More information about the Comp.lang.c mailing list