home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / C6_BUGS.ZIP / C6_20070.BUG < prev    next >
Text File  |  1990-09-11  |  3KB  |  102 lines

  1. Q62329 Internal Compiler Error '@(#)regMD.c:1.100', Line 4634
  2. Microsoft C Compiler (C)
  3. 6.00   | 6.00
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The two code samples below will produce the following internal
  9. compiler error when the code is compiled using the compact or large
  10. memory model:
  11.  
  12.    fatal error C1001: Internal Compiler Error
  13.    (compiler file '@(#)regMD.c:1.100', line 4634)
  14.    Contact Microsoft Product Support Services
  15.  
  16. This error can occur with various optimizations. In general, compiling
  17. with /Od (no optimization) or /Ox (maximum save optimization) will
  18. work correctly. In the following examples, there are various
  19. "failsafe" optimizations that can cause the error to go away. If one
  20. of these optimizations is used on a compile line that would otherwise
  21. cause the internal compiler error, the error will not appear.
  22.  
  23. More Information:
  24.  
  25.  1. /** Code Sample1 **/
  26.  2.
  27.  3. struct str
  28.  4. {
  29.  5.    int *a;
  30.  6.    int b;
  31.  7. };
  32.  8.
  33.  9. void foo(struct str * w)
  34. 10. {
  35. 11.    dog( w->a[(*w).b], w->a[w->b+1] & w->a[w->b]);
  36. 12. }
  37.  
  38. In this example, using any combination that doesn't include /Oe will
  39. result in the above error. As soon as /Oe is included, the error
  40. doesn't occur. For example:
  41.  
  42.    cl /c /AL /Oacgilnprstwz  foo.c    << Fails with error.
  43.  
  44.    cl /c /AL /Oacgilnprstwze foo.c    << Works correctly, no error.
  45.    cl /c /AL /Oanprswzx      foo.c    << Also works correctly.
  46.  
  47. In the second working compile line, remember that /Ox includes /Oe
  48. (actually /Ox = /Ocegilt /Gs).
  49.  
  50.  1. /** Code Sample2 **/
  51.  2.
  52.  3. struct cat{
  53.  4.    int x;
  54.  5.    int y;
  55.  6.    int dog[7];
  56.  7. };
  57.  8.
  58.  9. void g(struct cat foo[0][1])
  59. 10. {
  60. 11.    int a=0;
  61. 12.    int b=0;
  62. 13.    unsigned int  c=0;
  63. 14.
  64. 15.    char buf[1];
  65. 16.
  66. 17.    if(0);
  67. 18.
  68. 19.    buf[0] = foo[a][b].x << 1 + foo[a][b].y;
  69. 20.    buf[0] = c + foo[a][b].x;
  70. 21. }
  71.  
  72. In the above example, using /Oe will correct the problem. However, /Ol
  73. and /Og will also work correctly. Again, any combination of the other
  74. optimizations will result in the above error until one of the
  75. "failsafe" optimizations are used.
  76.  
  77. If you want to change the code in the program, the following are some
  78. code sequences that seem to cause the error:
  79.  
  80. 1. Global struct
  81.  
  82. 2. Structure passed to function
  83.  
  84. 3. Complex dereference of structure member
  85.  
  86. Usually, modifying the code to change this sequence will cause the
  87. error to go away. For instance, in Example 2, any of the following
  88. changes will eliminate the error:
  89.  
  90. 1. Change dog[7] to dog [6] and declare a dummy int to pad the
  91.    structure.
  92.  
  93. 2. Change "c" from an unsigned int to int.
  94.  
  95. 3. Change the order of the code or use a temporary variable in the
  96.    assignment statement.
  97.  
  98. Keywords:  buglist6.00
  99.  
  100. COPYRIGHT Microsoft Corporation, 1990.
  101. Updated  90/07/26 05:20
  102.