PPH93%DMSWWU1A.BITNET@cunyvm.cuny.edu (Thomas Heller) (05/27/91)
Some time ago I posted a question concerning bugs in the standard MINIX C-compiler (aka ACK). Thanks to the people, who responded to me question: "Bruce.Evans" <evans@syd.dit.csiro.au> "J. A. Reiss" <D1FRCMV0@EB0UB011> Magnus Doell <MDOELL@DOSUNI1> The following is a slightly edited SUMMARY of their responses: --------------------------------------------------------------------------- From: Magnus Doell <MDOELL@DOSUNI1> Hier sind 2 Fehler, die ich bisher gefunden habe und einige Macken: 1. Werden strings zu lang, so macht der Compiler Unsinn (mit falschen Meld.) 2. Rechnen mit unsigned longs kann zu Schwierigkeiten fuehren (ich kann mich noch erinnern, dass ich mal x-y in x+(-y) umwandlen musste). 3. Auf die Optimierungsoption -O muss manchmal verzichtet werden (z.B.: btoa ist mit nicht zu uebersetzen) 4. Manchmal (aus mir unerfindlichen Gruenden) verheddert sich der Prae- prozessor (z.B. bei estdio [zumindest in alten Versionen]). {poor translation by Thomas Heller} 1. The compiler becomes confused if strings are too long. 2. Computing with unsigned longs sometimes dont work. x-y is different from x+(-y). 3. Sometimes you cannot optimize (-O flag). 4. Sometimes the preprocessor becomes confused (old versions of estdio) --------------------------------------------------------------------------- From: "J. A. Reiss" <D1FRCMV0@EB0UB011> Hello, The bug i have found in ACK is that the *print* functions do not return an integer (the number of characters), but a char(?). Thus, if you try to compile any package that modify them, you will find some problems. I found it trying to compile fp.tar.Z (from plains), for having Floating Point support. I have tried to modified the functions and recompile the library (libc.a) but it did not work. I follow trying to find out whats wrong. BTW, if you have a look to stdio.h, you will find that before the function defination is there a big /* WRONG */. {Comment by Thomas Heller: This seems to me more than a library bug} --------------------------------------------------------------------------- From: "Bruce.Evans" <evans@syd.dit.csiro.au> I remember these. I'm sure the list is not complete :-). Some may be out of date. 1. sizeof "foo" is 2 instead of 4 (from wrong type char * ?) 2. static char foo[10] = "bar"; allocates 4 bytes instead of 10. 3. strings longer than about 128 crash the compiler. 4. statics in inner scopes don't work (?). 5. segment sizes >= 0x8000 are sign-extended to negatives in the exec header. 6. long sum; char *p; sum += 0xFF & *p; "bombs codegen". --------------------------------------------------------------------------- And here are bugs, I found myself in the meantime: 1. Large textsizes seem not to produce correct code, the limit I found seems to be around 60kBytes. (Although I'm not really sure if this is really a compiler/assembler bug or is a bug in my code). I would be happy, if someone can comment on this. 2. Problems with symbol names: If you have a module which uses a static VARIABLE named 'int index', and you use the 'index()' FUNCTION in another module, the compiler tries to jump to the address of the variable here (in the text-segment, if you have compiled with -i, but this is nevertheless wrong. No warning/error messages are printed. (This is a very nasty bug, I had to find it with the debugger). ---------------------------------------------- Thomas Heller, University of Muenster, Germany <PPH93@DMSWWU1A.BITNET>