MMIX LOGO

MMIX Bug Report Umlaut in Strings and Character Constants

Table of Content

Content

MMIXware Version

mmix-20110831

Bug Reported

Initial: 24/4/2013

Author

Martin Ruckert

Description

mmixal considers character codes greater than 127 in strings and character constants as too big to fit in one byte.

Details

The following MMIX program
	LOC	#100
	GREG	@
a	BYTE	"pâté",10,0
b	BYTE	'p','â','t','é',10,0
c	BYTE	#70,#E2,#74,#E9,10,0

Main	LDA	$255,a
	TRAP	0,Fputs,StdOut
	LDA	$255,b
	TRAP	0,Fputs,StdOut
	LDA	$255,c
	TRAP	0,Fputs,StdOut
	ADD	$255,$255,'â'
	TRAP	0,Halt,0
produces the following warnings:
"byte.mms", line 3 warning: constant doesn't fit in one byte
"byte.mms", line 3 warning: constant doesn't fit in one byte
"byte.mms", line 4 warning: constant doesn't fit in one byte
"byte.mms", line 4 warning: constant doesn't fit in one byte
"byte.mms", line 13 warning: Z field doesn't fit in one byte
The documentation to mmixal, however, states:

"In the present implementation a character constant will always be at most 255, since wyde character input is not supported." The problem is caused by the assignment

acc.h=0, acc.l=*p;
in the sections "Scan a character constant" and "Scan a string constant". Where p points to a char, which might be signed or unsigned depending on the compiler. In case the compiler uses signed characters, the sign extension will fill the low TETRA of acc, making the value too big to fit in one byte.

Proposed Patch

In mmixal.w the line
acc.h=0, acc.l=*p;
is replaced by
acc.h=0, acc.l=(unsigned char)*p;
in both sections "Scan a character constant" and "Scan a string constant".

Discussion

The patch as given above id now part of the latest sources.

Please help to keep this site up to date! If you want to point out important material or projects that are not listed here, if you find errors or want to suggest improvements, please send email to email