@ LATTICE,INC. It Is
Total Page:16
File Type:pdf, Size:1020Kb
@ LATTICE,INC. P. O. BOX 3072 ·GLENÉLLYN·LLNOIS 60138· 3l2/858ñ9!5OU1NX9lO29l-2l9O TECHNICAL BULLETIN TB841101.001 DATE: November 1, 1984 PRODUCT: 8086/8088 C Compiler SUBjECT: Known Bugs in Version 2.14 Recently three bugs concerning the Version 2.14 libraries and startup modules have come to light. Two of these pertain to the sensing and use of the 8087 co-processor, and the other concerns the use of the "malloc'° and "getmem" functions under MS-DOS 1 in the s and P models of the compiler. In addition some code was oMtted from the file " main.c". 1. Floating Point Bugs (a) Sensing cjf the 8087 The technique employed in the run-time library to sense the presence of the 8087 co-processor does not work in V2.14 because the 8087 is not initialized prior to the test. Correcting this problem is rather easy. You need only add a line of code to the file °'c.asm" provided with the compiler and reassemble this to replace the current "c.obj". file In the file "c.asm" you will find a line: CALL JLAIN just prior to this line, insert the fcülowing line DB ODBh,OE3h ; FNINIT instruction Then reassemble "c.asm" for each of the memory models as follows: -- Copy "c.asm" to the appropriate model subdirectory (i.e., \lc\s, \lc\d, \lc\p, or \lc\l) so that is in the same directory as "dos.mac" for it the appropriate memory mcdel. -- Use the command 1 @ LATTICE,1NC. W P. O. BOX 3Q72 ·GL£N ELLYN ·ILLNO1S 60138 · 312/858-7950·TWX9lO291-2 masm c; to assemble "c.asm" into "c.obj". The instruction is specified here as a "DB" pseudo-op rather than an "FFNIT' instruction since many assemblers do not properly handle floating point instructions. Should your assembler be able to handle such instructions, be sure to use an "FNINIT" instruction rather than "FINIT" Qr else the assembler will generate a "WAIT" instruction prior to the °'FINIT" and resulting programs will wait endlessly on machines not containing a co-processor. (b) Floating Point in the D arid L Mdels In attempting to repair an earlier bug concerning the 8087 we accidentally broke its use in the D and L models. To correct the problem you can use "debug" to patch the libraries "lcmd.lib" and "lcml.lib" as follows. (Underlined portions are what you must type. Each line must be entered with a carriage return.) (i) Patching lcmd.lib >debuq lcmd.lib -eA97A 10.12 -eA9CC 78.76 -W -SI > (ii) Patching lcml.lib Aebug Icínl.Iíb -eBB71 12.14 -eBBC7 3D.3B -W -g > (C} Bug in 8087 Library Divide Routine Under certain circumstances the floating point division function Cxd55 will return the incorrect value when an 2 @ LATTICE, INC. P. O. BOX 3072 · GLEN ELLYN · LUNOIS 60138 · 312/858-7950 · TWX 9lO29l-2l90 8087 is present since this function fails to save and restore the DI register. This bug will be repaired in a future release . (2) Ma1loc and Getmem under MS-DOS 1 The S and P model library memory allocation functions "malloc" and "getmem" will n<jt return the correct values in an application running under MS-DOS 1 when a to one of call 6 these would cause the total memory allocated to exceed 4K. In particular the failure value of NULL will not be returned in this case. This problem will be fixed in a future release, and it does not effect the D and L modelm ( 3) Omission in 'Lmain.c" The last "exit(O);" statement should be replaced with Ñifndef TINY ' exit(0); #else exit(0); Tencí if *** END **" 3 @ LATTICE,INC. P. O. BOX 3072 · awELLvN· LLINOQS 6Ol380 JR/B58J950·TWX9I029I-2I% TECHNICAL BULLETIN TB8410¶0.001 DATE: october TO, 1984 PRODUCT: 8086/8080 C Compiler SUBjECT: Ver3ion 2.14 Update VerMon 2.14 of the 8D86/808B C compiler hm been released to correct the following problenm 1. In VerMon 2,¶3, the S model libr&ríeg were built in 8UCÍll the a way that the floating poInt operattom did not me 8087 chip ff pregent. The other memory model$ worked correctly. 2. Klhíle ffxfng the PUTC problem In VerMon 2.fj, we broke the level 2 buffer flmh function 9n mich & way that buffer8 were mnnethnes written twice. Thlg would occur when you did several FSEEKg without intervening re&dg or vrítm. 3. UNGETC did not alwayg work correctly under the d md L modelg, depending on where the buffer ma® lomted. 000END$0* 1 @ LATTICE,INC. P. O BOX 3on·cA£NELlNN·LLlNo|s6oí38· 3u/85B-795o0Twx9m9l.2l9o TECHNICAL BULLETIN TB8410¶0.002 DATE: October tO, 1984 PRODUCT: 8086/0088 C Complier SUBjECT: Insufficient Memory Mesmge In bulletfn TB840914.otn we mentioned a problem observed during the tesMng of vergjcyn 2.13 that resulted in an "!nsuff!cient memory" message. At that tfme, we believed that the message was orSgínatfng from Hs-ljOS. Hell, we must admit with a blush that the message was coming from C.ASl'l, our start-up mdule. The situation leading to this meggage wá3 that we forked a child prDc'e53 wttcjse .EXE file jU9t barely fit into the available memory. After loading the .EXE file, FfS-ljOS passed control to the child procesg at the C.ASM entry point. C.ASM then attempted to allocate gtack and he€p 8pace for the C program, but there wá9 not enough memory. When that occurred, C.ASK dlmplayed the '°ínsufficient memory" me33age and aborted with a non-zero exit code. The migtake we made in our tmt program w39 to examine only the return code from the FORKL function. Thig wIll indicate an error only If MS-DOS wá9 unable to obtain the needed gpace and load the ch9ld program. He should have &Ííorj U3ed the WAIT functfon to check the exit code from the child. ""END°"" E @ LATTICE,INC. P O DOX 3072·GLENELLYN·LLNOS 60138· 312/858795O·TwX91O29i-2l9O TECHNICAL BULLETIN TBB41010.003 WLTE: October 10, 1984 PRODUCT: 8086/8088 C Compiler SUBJEC"I); Combining LC and LCM Librar!eg LC TB840914.OQI we g&ve a Mmple procedure for combtnlng the In became and LCM librarfes. Some people who tried this procedure concerned about the duplicate symbol me3gageg that regulted. Here is a better procedure: 1. Use your favorite editor to create the file MIXLC.LNK containing the following: bu Icc.lfb tí lcm.líb fL lc.lib exc _pfmt,cprlntf,fprintf,printf,gprintf gfmt,c8canf,fgcanf,gcanf,g5c8nf exc — 2. For each memory model, copy MIXLC.LNK into the \lc\x directory, where x is g, p, d, or I. Then U9é CD to get into that directory, and execute PLIB86 &g follows: plib86 émlxlc Thig procedure creatm a combined library LCC.LIB which ínclude3 the complete verMons of the PRINTF/SCANF functlonm If you vant 8 combined library that contains the abbreviated verMons, Mmply Interchange the two "ft" commandg In HIXLC.LNK. "'"END000 1 @ LATTICE, INC. P O BOX jon·gLENEtlYN·LlNcMs 6Olj8 · 312/858795O·TWx9l029l.2l9O TECHNICAL BULLETIN TB8U)9ICOO1 DATE: September 1984 PRODUCT: 8086/8088u, C Compiler SUBJECT: Version 2.¶3 UHate VerMOn 2.1J of the 8086/8088 C compiler has been relemed to correct the following problems: I. STRCMP and STRNC6IP did not return the correct results when ccmparlng string3 of unequal lengthm 2. The various form8 of PUTC did not work correctíY under the D and L modelm The of a floatfng-polnt divide-by-zero operation j. results when 8007 with an 8087 installed were not the Bame 88 the wag removed. 4. Several problems exi8ted in the varÍoü8 FORK functfonm (a) The environment 8trlng array va8 sot pamed correctly to the child Process under the S &nd P memory models. tb) An extra backslash wa8 appended to the PATH variable. ThG wm usually accepted by PCDOS, but waB rejected by 9otñe MSDOS fmplementationm (C) The construction of default FCBS did not Hop vhen an argument beginnfng with a Uash w33 reached. This caused problem for 8ocñe older programs that relied on the FCB setup done by the MSDOS command processor. (d) The fork logic searched for a .EXE file before a .COM fije. Thi8 hag been reversed because some people keep the .EXE version around even after they have generated a .COM. 1 @ LATÍ1CE, INC. P. O BOX 3072 · GLEN ELLYN · UNOSS 60138 · JJ2/858 7950· JWX 910 291 219' (e ) A carriage return was not appended to the generated command string, which caused some forked programs to t f a I . These problems usually showed up when you tried to fork the command processor or when the chi Id process attempted to use the inherited environment. Td sImplify the invocation of the command processor, we've addeQ & UNIX-compatfble SYSTEI·) f unct ion. The function has one argument, the command gtríng, and returns the same results as FORKL. For exemple, systemC"dir a:") calls the command processor to display the directory frorn drSve A. Nhíle testing the fork functions, we observed what appears to be an HS-IJOS bug. Hhen the operating system cannot obtain enough memory to load the prográm, cocjé child it's supposed to return error B that we wIll then pass back to you In _oserr. However, En some cases, t·lS-DOS displays the message "jnsuf f lcient memDTy" on the screen and returns a succem code. This has been observed on PC-DOS 2.1 and 3.0 running on the IBH-XT and IBH-AT and in the version of MS-DOS currently running on the TANDY 2000.