[BUG]3.86461 Compiler problem?

Tim Rowledge tim at sumeru.stanford.edu
Wed Dec 1 00:44:32 UTC 2004


Whilst running the SUnit suite I got a _really_ puzzling failure
(amongst the less puzzling failures) where it seems like the Compiler
is broken.

Somewhere in the suite,
TTFontReader>processHorizontalMetricsTable:length: is decompiled and
recompiled. In the process the code is broken.

Original as written by Andreas:-
processHorizontalMetricsTable: entry length: numHMetrics
	"Extract the advance width, left side bearing, and right
	side bearing for each glyph from the Horizontal Metrics Table."
	|  index lastAW glyph |
	index _ 1.
	[index <= numHMetrics] whileTrue:[
		glyph _ glyphs at: index.
		glyph advanceWidth: entry nextUShort.
		glyph leftSideBearing: entry nextShort.
		glyph updateRightSideBearing.
		index _ index + 1].
	index = (nGlyphs +1) ifTrue:[^true].
	lastAW _ (glyphs at: index-1) advanceWidth.

	[index <= nGlyphs] whileTrue:[
		glyph _ glyphs at: index.
		glyph advanceWidth: lastAW.
		glyph leftSideBearing: entry nextShort.
		glyph updateRightSideBearing.
		index _ index + 1]. 

as complained about in a SyntaxError notifier
processHorizontalMetricsTable: t1 length: t2 
	| t4 t5 t3|
	1
		to: t2
		do: [:t3 | 
			t5 := glyphs at: t3.
			t5 advanceWidth: t1 nextUShort.
			t5 leftSideBearing: t1 nextShort.
			t5 updateRightSideBearing].
	t3 = (nGlyphs + 1)
		ifTrue: [^ true].
	t4 := (glyphs at: t3 - 1) advanceWidth.
	[t3 <= nGlyphs]
		whileTrue: [t5 := glyphs at: t3.
			t5 advanceWidth: t4.
			t5 leftSideBearing: t1 nextShort.
			t5 updateRightSideBearing.
			t3 := t3 + 1]

which is
a) broken because t3 is out of scope after the first block and
b) not teribly like the original.

I'm not convinced a transform that produces broken code is a very good
transform...

tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Portable:  Survives system reboot.



More information about the Squeak-dev mailing list