home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2155 < prev    next >
Internet Message Format  |  1990-12-28  |  2KB

  1. From: berg@cip-s07.informatik.rwth-aachen.de (AKA Solitair)
  2. Newsgroups: alt.sources,comp.os.msdos.misc
  3. Subject: TurboC++ v1.00 bug/patch
  4. Message-ID: <3707@rwthinf.UUCP>
  5. Date: 26 Nov 90 11:01:52 GMT
  6.  
  7. Patches for TC++ v1.00
  8. To fix the case statement.  It behaved uncorrectly for unsigned ints bigger
  9. than 0x7fff.  This error was in both the C and the C++ part, in both
  10. tcc.exe and tc.exe.  Since I only needed tcc.exe for the project, I
  11. only have fixed that one;  as a side effect, the recipe patch for the
  12. C++ part also works on tc.exe.
  13.  
  14. To check if your compiler still has the bug, run the following program:
  15. -----------------------------------------------------------------------
  16. #include <stdio.h>
  17.  
  18. main(){unsigned i;
  19.  i=0x4000;i<<=1;
  20.  switch(i){
  21.    case 0x1000:i=1;break;
  22.    case 0x2000:i=2;break;
  23.    case 0x8000:i=3;break;
  24.    case 0x4000:i=4;break;}
  25.  printf("If %u!=3 then there definitely is a bug.\n",i);}
  26. -----------------------------------------------------------------------
  27. The patch is as follows:
  28. offset: old new   (only for tcc.exe, the command line version)
  29.  
  30. 24595: 06 16    Fixes C compiler part.
  31. 24596: 9C 9A
  32. 24598: 7C 7E
  33. 2459A: 7F EB
  34.  
  35. 35BB1: 8E EB    Fixes C++ compiler part.
  36. 35BB2: 06 1A
  37. 35BBE: 46 56
  38. 35BBF: FC FA
  39. 35BC0: 7C 7E
  40. 35BC2: 75 EB
  41. 35BC3: 05 28
  42. 35BDD: 0E D7
  43. 35BE2: 09 D2
  44.  
  45. Or as a recipe (use this if the offsets, or values don't match exactly):
  46. (??= don't care; ..= old value; xx,yy,zz have to be copied)
  47.  
  48. Find the following string in tcc.exe (C compiler part):
  49. 26 8b 45 04 26 8b 55 02 3b 06 ?? ?? 7c 0c 7f 06 3b 16 xx yy 76 04 33 ff eb 0e
  50. Substitute by:
  51. .. .. .. .. .. .. .. .. .. 16 xx yy 7e .. eb
  52.  
  53. Find the following string in tcc.exe or tc.exe (C++ compiler part):
  54. 26 8b 3d 0b ff 74 18 8e 06 ?? ?? 26 8b 45 04 26 8b 55 02 3b 46 ?? 7c e1 75 05
  55. 3b 56 zz 72 da 0b ff 74 1f 8e 06 ?? ?? 26 8b 45 04 26 8b 55 02 3b 46 ?? 75 0e
  56. 3b 56 ?? 75 09
  57. Substitute by:
  58. .. .. .. .. .. .. .. eb 1a .. .. .. .. .. .. .. .. .. .. .. 56 zz 7e .. eb 28
  59. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. d7
  60. .. .. .. .. d2
  61. --
  62. Sincerely,                 berg%cip-s01.informatik.rwth-aachen.de@unido.bitnet
  63.            Stephen R. van den Berg.
  64. "I code it in 5 min, optimize it in 90 min, because it's so well optimized:
  65. it runs in only 5 min.  Actually, most of the time I optimize programs."
  66.