home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 August / CICA.cdr / cis_libs / mswin32 / 7 / clbug.lst < prev    next >
Encoding:
File List  |  1992-12-11  |  8.1 KB  |  298 lines

  1. ---------------------------------------------------------------------- 
  2.  1.  Expression var = value >= 0.0 ? 1.0 : -1.0;  Does Not Work
  3.  
  4.      The follwing program illustrates the problem:
  5.  
  6.      /* Compiler options needed: -Od
  7.      */
  8.  
  9.      #include <stdio.h>
  10.      main()
  11.      {
  12.     double value = 30720.0 ;
  13.     double sign, sign2 ;
  14.  
  15.     // Should work, but doesn't; used to work in July Release
  16.     sign = value >= 0.0 ? 1.0 : -1.0;
  17.  
  18.     // workaround
  19.     if (value >= 0.0)
  20.        sign2 = 1.0;
  21.     else
  22.        sign2 = -1.0;
  23.  
  24.     // results:  Sign : 2.122e-313 ; Sign2 : 1
  25.     printf("Sign : %g ; Sign2 ; %g \n", sign, sign2);
  26.      }
  27.  
  28. ----------------------------------------------------------------------
  29.  2.  Error C2468: 'new' : 'const'/'volatile' Generated
  30.  
  31.      Regression from the July release. ARM 5.3.3 states that 
  32.      type-specifier-list may not contain const, volatile, class 
  33.      declarations or enum declarations. 
  34.  
  35.      /* Compile options needed: none
  36.      */
  37.  
  38.      void foo (void)
  39.      {
  40.     const int **ppi;
  41.     ppi  = new const int *[10];
  42.      }
  43.  
  44. ----------------------------------------------------------------------
  45.  3.  -Zg Gives Internal Compiler Error With __stdcall
  46.  
  47.      /* Compile options needed: -Zg
  48.      */
  49.  
  50.      int __stdcall foo (char *, ...);
  51.  
  52. ----------------------------------------------------------------------
  53.  4.  Code Generation Problem 
  54.  
  55.      The asm code is wrong. It looks like the compiler noticed 
  56.      that all it had to do was compare ah to 9, but the asm code is
  57.      cmp eax to 9.
  58.  
  59.      /* Compile options needed: -Fa
  60.      */
  61.  
  62.      main () {
  63.     unsigned num;
  64.     unsigned x;
  65.  
  66.     num = 1388;
  67.  
  68.     if (((unsigned char) ((num & 0x00000F00) >> 8)) > 9)
  69.        x = num;
  70.     else
  71.        x = num + 1;
  72.      }
  73.  
  74.      ; assembly code generated
  75.  
  76.      _main   PROC NEAR ; Line 2
  77.     push    ebp
  78.     mov     ebp, esp
  79.     sub     esp, 8
  80.     push    ebx
  81.     push    esi
  82.     push    edi ; Line 7
  83.     mov     DWORD PTR _num$[ebp], 1388        ; 0000056cH ; Line 9
  84.     mov     eax, DWORD PTR _num$[ebp]
  85.     and     eax, 3840                         ; 00000f00H
  86.     cmp     eax, 9
  87.     jle     $L109 ; Line 10
  88.     mov     eax, DWORD PTR _num$[ebp]
  89.     mov     DWORD PTR _x$[ebp], eax ; Line 11
  90.     jmp     $L110 $L109: ; Line 12
  91.     mov     eax, DWORD PTR _num$[ebp]
  92.     inc     eax
  93.     mov     DWORD PTR _x$[ebp], eax $L110:    ; Line 14 $L106:
  94.     pop     edi
  95.     pop     esi
  96.     pop     ebx
  97.     leave
  98.     ret     0 
  99.      _main   ENDP _TEXT   ENDS END
  100.  
  101. ----------------------------------------------------------------------
  102.  5.  Code Generation Problem For Default Arguments in C++
  103.  
  104.      The wrong parameter is used to fill in default argments in C++.
  105.  
  106. ----------------------------------------------------------------------
  107.  6.  Incorrect Syntax Errors Initializing Static Object
  108.  
  109.      This is a regression from the July release.
  110.  
  111. ----------------------------------------------------------------------
  112.  7.  -Od -Zi Cause Assert in P2 emit.c db_name (name==NULL)
  113.  
  114.      /* Compile options needed: -Od -Zi
  115.      */
  116.  
  117.      static union {char *bptr; long *lptr; short *sptr;};
  118.      char * func()
  119.      {
  120.     return bptr;
  121.      }
  122.  
  123. ----------------------------------------------------------------------
  124.  8.  Allocation Size of enum Must be 4, Not 2 in C++
  125.  
  126.      The output of this program is:
  127.  
  128.     Size of Message type: [4]
  129.     Size of Message Descriptor: [44]
  130.  
  131.      The size of operator of enum returns 4 while the allocator of the
  132.      table is using 2. The size of operator of the structure is using 
  133.      44 while the actual size is 40.
  134.  
  135.      /* Compiler options needed: -Od 
  136.      */
  137.  
  138.      #include <stdio.h>
  139.      #include <malloc.h>
  140.  
  141.      #define ERROR 1
  142.      #define STANDARD 2
  143.  
  144.      typedef unsigned char   U8;      /* byte */
  145.      typedef unsigned char   u8;      /* byte */
  146.      typedef u8              BOOLEAN;
  147.  
  148.      enum MESSAGE_TYPE {
  149.     FIRST_MESSAGE_TYPE = 0,
  150.     INFO = 0,
  151.     WARNING = 1,
  152.     ERROR = 2,
  153.     FATAL = 3,
  154.     N_MESSAGE_TYPES = 4
  155.      };
  156.  
  157.      enum MESSAGE_CATEGORY {
  158.     FIRST_MESSAGE_CATEGORY = 0,
  159.     STANDARD = 0,
  160.     PERFORMANCE = 1,
  161.     SOURCE_ANALYSIS = 2,
  162.     SYNCHRONIZATION = 3,
  163.     VERBOSE = 4,
  164.     TEXT_FRAGMENT = 5,
  165.     N_MESSAGE_CATEGORIES = 6
  166.      };
  167.  
  168.      struct Message_descriptor {
  169.        char*                 tag;
  170.        enum MESSAGE_TYPE     type;
  171.        enum MESSAGE_CATEGORY category;
  172.        int                   n_printed;
  173.        int                   n_suppressed;
  174.        BOOLEAN               enabled_sw;             
  175.        BOOLEAN               default_enabled_sw;
  176.        BOOLEAN               pass_2_enable;
  177.        U8                    audit_flag;
  178.        int                   suppression_threshold;
  179.        int                   message_id;
  180.        int                   arg_count;
  181.        BOOLEAN               no_prefix;
  182.        BOOLEAN               include_in_message_summary;
  183.        char*                 text;
  184.      };
  185.  
  186.      struct Message_descriptor msg_desc [] = {
  187.     #if 0
  188.     { "ISDVECTOR", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
  189.          "Message 1" },
  190.     { "ISDBASED", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
  191.          "Message 2" },
  192.     { "ISDPROTECT", ERROR, STANDARD, 0,0,1,1,0,3,10, 0, 1, 0, 1,
  193.          "Message 3" },
  194.     #endif
  195.  
  196.     { "ISDCONFLICT", ERROR, STANDARD, 0,0,1,1,0,1,10, 0, 1, 0, 1,
  197.          "Message 4"}
  198.      };
  199.  
  200.      int main (int argc, char* argv[])
  201.      {
  202.     printf("Size of Message type: [%i]\n", 
  203.        sizeof(enum MESSAGE_TYPE));
  204.  
  205.     printf ("Size of Message Descriptor: [%i]\n",
  206.        sizeof(struct Message_descriptor));
  207.     return 0;
  208.      } 
  209.  
  210. ----------------------------------------------------------------------
  211. 9.  Incorrect Floating Point Results
  212.  
  213.     In the program output, the values of g and h are zero. This code
  214.     worked in the July release.
  215.  
  216.     /* Compiler options needed: none
  217.     */
  218.  
  219.     #include <stdio.h>
  220.  
  221.     main( int argc, char *argv[] )
  222.     {
  223.        int flag = 1;
  224.        double g = (flag ? 1.0 : 2.0);
  225.        double h = (flag ? 2.0 : 1.0);
  226.  
  227.        printf( "flag %d, g %f, h %f\n", flag, g, h );
  228.  
  229.        return 0;
  230.     }
  231.  
  232. ----------------------------------------------------------------------
  233. 10.  C4018: '==' signed/unsigned mismatch Generated Incorrectly
  234.  
  235.      This is a regression from the July release.
  236.  
  237. ----------------------------------------------------------------------
  238. 11.  MFC Apps Fail to Link Due To Unresolved Externals
  239.  
  240.      The fix was to make static member functions assume the ambient 
  241.      calling convention.
  242.  
  243. ----------------------------------------------------------------------
  244. 12.  Incorrect Syntax Error For Function-style Cast
  245.  
  246.      The errors generated are:
  247.  
  248.     error C2144: syntax error : missing ')' before type 'Id'
  249.     error C2512: 'Other' : no appropriate default constructor 
  250.        available
  251.  
  252.      This is a regression from the July release
  253.  
  254.      /* Compiler options needed: none
  255.      */
  256.  
  257.      class Id {
  258.      public:
  259.     Id(int) {}
  260.      };
  261.  
  262.      class Other {
  263.      public:
  264.     Other(Id);
  265.      };
  266.  
  267.      void func(int xx) {
  268.     Other *off;
  269.     Other ot(Id(1));          // Compiles
  270.     Other ot2((Id)1);         // Compiles
  271.     Other ot3(Id(xx));        // Compiles
  272.     Other ot4((Id)xx);        // Compiles
  273.     off=new Other((Id)xx);    // Compiles
  274.     off=new Other(Id(xx));    // Syntax error
  275.      }
  276.  
  277. ----------------------------------------------------------------------
  278. 13.  Incorrect C2177, C4056 and Floating-point Values 
  279.  
  280.      When these errors occur, sometimes values in the array are 
  281.      initialized correctly and other times they are completely wrong.  
  282.      With the same test values, the results are consistent from 
  283.      compile to compile, however when other numbers (in range) are 
  284.      specified, the values are incorrect.  When the values are wrong, 
  285.      they usually turn into 1.61667e-308.
  286.  
  287.     error C2177: constant too big 
  288.     warning C4056: overflow in float-point constant arithmetic
  289.     
  290.      This is a regression from the July release.
  291.  
  292. ----------------------------------------------------------------------
  293. 14.  Initialization of Static Array Loops Indefinitely
  294.  
  295.      The algorithm for initialization was n-cubed.  This was fixed.
  296.  
  297. ----------------------------------------------------------------------
  298.