[comp.lang.c] MS C 5.1 bug: global variable definition

cb@sequoia.UUCP (Christopher D. Brown) (06/28/89)

Use the Microsoft C 5.1 command line
   CL /AL /Gt0 /Fa /c
to generate assembly and object code for both BUG.C and NOBUG.C.
Note that only NOBUG produces the public symbol _a_var.

Source file BUG.C is as follows:
   int near a_var;
Generated file BUG.ASM includes the following code:
   _BSS   SEGMENT
   COMM NEAR _a_var: BYTE: 2
   _BSS   ENDS

Source file NOBUG.C is as follows:
   int near a_var = 0;
Generated file NOBUG.ASM includes the following (correct) code:
   PUBLIC _a_var
   _DATA  SEGMENT
   _a_var DW      00H
   _DATA  ENDS

Christopher D. Brown