J'ai compilé le gcc 4.6.0 pour mmix selon http://www.bitrange.com/mmix/install.html. Après avoir essayé leur simple hello world, ou tout autre appel à printf avec plus que la première chaîne, seule la première chaîne est imprimée. Par exemple.Problème Printf avec gcc sur mmix
[email protected]:~/f/c> cat hellommix.c
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
printf ("hello, %s\n", argc > 1 ? argv[1] : "world");
exit (0);
}
[email protected]:~/f/c> mmix-gcc hellommix.c
[email protected]:~/f/c> mmix ./a.out "abc"
hello, [email protected]:~/f/c>
L'assembleur généré ressemble à ceci:
# 1 "hellommix.c"
! mmixal:= 8H LOC Data_Section
.text ! mmixal:= 9H LOC 8B
.section .rodata
.p2align 2
LOC @+([email protected])&3
LC:0 IS @
BYTE "world",#0
.p2align 2
LOC @+([email protected])&3
LC:1 IS @
BYTE "hello, %s",#a,#0
.text ! mmixal:= 9H LOC 8B
.p2align 2
LOC @+([email protected])&3
.global main
main IS @
SUBU $254,$254,24
STOU $253,$254,16
ADDU $253,$254,24
GET $2,rJ
SET $3,$0
SUBU $0,$253,24
STOU $1,$0,0
SUBU $0,$253,12
STTU $3,$0,0
SUBU $0,$253,12
LDT $0,$0,0
SLU $0,$0,32
SR $0,$0,32
CMP $0,$0,1
BNP $0,L:2
SUBU $0,$253,24
LDO $0,$0,0
LDO $0,$0,8
JMP L:3
L:2 IS @
GETA $0,LC:0
L:3 IS @
GETA $5,LC:1
SET $6,$0
PUSHJ $4,printf
PUT rJ,$2
SETL $5,0
PUSHJ $4,exit
.data ! mmixal:= 8H LOC 9B
Je ne sais pas cet environnement, mais vous pourriez souffrir de mise en mémoire tampon. De nombreux environnements sont mis en mémoire tampon et vident le tampon sur une nouvelle ligne \ n. Essayez d'ajouter un '\ n' au dernier printf. – cdarke
Merci, mais cela ne résout pas cela. –
Ceci est juste un tir dans le noir, mais est-ce que mmix-gcc hellommix.c -o hellommix' suivi de 'mmix hellommix" abc "' fonctionne mieux? (qui correspond plus étroitement à l'exemple dans le lien que vous avez posté, et est en ligne avec la mise en garde: __Caution: n'utilisez jamais de chemins relatifs (../dir), utilisez toujours des chemins absolus (/ path/to/dir) __) –