ehoogerbeets@rose.waterloo.edu (Edwin Hoogerbeets) (06/07/89)
The following source:
foo()
{
char *foobar;
if ( foobar ) {
printf("This is a test\n");
}
if ( (char *)0 ) {
printf("This is a test\n");
}
if ( "This is a test\n" ) {
printf("This is a test\n");
}
}
Gets compiled to this assembler:
;:ts=8
public _foo
_foo:
link a5,#.2
[.... etc ... ]
.5
tst.l #.1+32 ; whoops! this address mode isn't supported for 68000s
beq .6
pea .1+48
jsr _printf
add.w #4,sp
.6
.7
movem.l (sp)+,.3
unlk a5
rts
.2 equ -4
.3 reg
.1
dc.b 84,104,105,115,32,105,115,32,97,32,116,101,115,116,10
dc.b 0,84,104,105,115,32,105,115,32,97,32,116,101,115,116
dc.b 10,0,84,104,105,115,32,105,115,32,97,32,116,101,115
dc.b 116,10,0,84,104,105,115,32,105,115,32,97,32,116,101
dc.b 115,116,10,0
ds 0
public _printf
public .begin
dseg
end
I am using Manx v3.6, with the simple command line: cc foo.c
Manx's own assembler tosses cookies on this. I know it is pretty gross
C code, but it occurs in GnuGrep (fish 204), and probably other Gnu
code.
Can anyone verify this, or I am doing something wierd?
Edwin