[comp.os.minix] ST ACK compiler bug

V61%DHDURZ1.BITNET@cunyvm.cuny.edu (Ronald Lamprecht) (06/09/89)

The ACK compiler (ST) makes an error when compiling  *"string"  statements:

test()
{
  fkt( *"A" );
}

Will be compiled with -O -S options to:

.sect .text;.sect .rom;.sect .data;.sect .bss
.extern _test
.sect .text
_test:
link    a6,#-0
pea _1
move.w (sp)+,d2
ext.w d2
move.w d2,-(sp)
jsr _fkt
add.l #2,sp
unlk a6
rts
.sect .data
_1:
.data2    16640
.sect .text

Obviously address bits 16 to 23 will be taken as result instead of the data
byte and an additional stack error is only hidden by the unlink statement in
this example. In real life all saved register variables of the calling function
would be mixed up (That's the way I detected this error after a several hours
search when porting zoo to Minix).

With appropriated casts errors could be avoided:

test()
{
  fkt( * ((char *)"A") );
}

will be compiled correctly to:

.sect .text;.sect .rom;.sect .data;.sect .bss
.extern _test
.sect .text
_test:
link    a6,#-0
move.b _1,d0
ext.w d0
move.w d0,-(sp)
jsr _fkt
add.l #2,sp
unlk a6
rts
.sect .data
_1:
.data2    16640
.sect .text


Could this and several further compiler bugs be fixed and the improved
files be posted, or do we need another standard real public domain
compiler ?

Bitnet:  V61@DHDURZ1                               Ronald Lamprecht
UUCP:    ...!unido!DHDURZ1.bitnet!V61              Theoretische Physik
ARPAnet: V61%DHDURZ1.BITNET@CUNYVM.CUNY.EDU       (Heidelberg, West Germany)