[comp.os.vms] BUG in VAXC??

BOL@HWALHW50.BITNET (04/07/88)

    When debugging a C-program with many global variables I came across
    some incorrect results  given by the debugger.

    Consider the following simple program with 260 global variables:

 /*-----------------------------------------------------------------------*/
 int v1  ,v2  ,v3  ,v4  ,v5  ,v6  ,v7  ,v8  ,v9  ,v10 ;
 int v11 ,v12 , ....;
    ...
 int v240,v241, ...;
 int v251,v252,v253,v254,v255,v256,v257,v258,v259,v260;

 main(){
    v1 = 1; v256 = 256;
    v2 = 2; v258 = v256+2;
    printf("\n V1=%d   V2=%d   V256=%d   v258=%d", v1, v2, v256, v258);
    printf("\n&V1=%d  &V2=%d  &V256=%d  &v258=%d",&v1,&v2,&v256,&v258);
 }
 /*-----------------------------------------------------------------------*/

    The printed results are :

  V1=1   V2=2   V256=256   V258=258
 &V1=584  &V2=1028  &V256=1280  &V258=1288

    However the debugger gives the following results:

 DBG>examine v1,v2,v256,v258
 1
 2
 1
 2


 DBG>evaluate &v1,&v2,&v256,&v258
 584
 1028
 584
 1028

    So the addresses for V256 and V258 are the same as for V1 and V2.

    It seems to me that the symboltable information is probably incorrect
    if there are more then 255 global variables in 1 sourcefile.

    Or perhaps there is a (hidden) limit of 255 global variables in 1
    sourcefile. The manuals say nothing about this. Is there anyone
    who can give me an explanation for these results?


                                Kees Bol        BOL@HWALHW50.bitnet