home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / win32 / 2588 < prev    next >
Encoding:
Text File  |  1992-12-24  |  8.4 KB  |  319 lines

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