[fa.info-vax] VMS C V2.0 Compiler bug

info-vax@ucbvax.ARPA (08/23/85)

From: Randy Buckland <decvax!mcnc!rti-sel!rcb@BERKELEY>

To all VMS C V2.0 users,

I have detected a bug in the vaxc v2.0 run time library. In the routine
SSCANF, a data area is allocate on the stack and some information about
the incomming parameters is placed in this data area. The address of the
data area is then passed to the routine $$DOSCAN. This routine then
verifies the validity of the parameters. In doing so, it loads the
address of the data buffer plus an offset of 0x0e2 and then test
for a 0 bit clear at an offset of 0x018 from this address. This
area is on the stack buffer allocated by SSCANF but was never set by
SSCANF. The results of this test are therefore random. If the test fails,
SSCANF returns with the code -1 to indicate failure.

The following patch will correct for this fault until a new version of the
RTL comes out with the bug really corrected.

PATCH>set mode ins
PATCH>e sscanf+2
SSCANF+2:  JMP     L^00003490
PATCH>e 3490
00003490:  SUBL2   #000003D5,SP
PATCH>e 3490+20
000034B0:  MOVL    R0,(R7)
PATCH>insert 34b0 = 'movl r0,(r7)'
NEW>  'clrb w^00fa(r7)'
NEW>  exit
old:	000034B0:  MOVL    R0,(R7)
old:	000034B3:  BISB2   #41,B^0C(R7)
new:	000034B0:  JMP     L^PAA
new:	000034B6:  NOP     
new:	000034B7:  NOP     
new:	PAA:  MOVL    R0,(R7)
new:	0000CC03:  CLRB    W^00FA(R7)
new:	0000CC07:  BISB2   #41,B^0C(R7)
new:	0000CC0C:  JMP     L^000034B8
PATCH>update

The patched rtl must then be reinstalled if it was previously installed
for this to take effect.