Serious Compiler Bug when using to:do:

Sam Adams ssadams at us.ibm.com
Fri Jan 23 19:54:53 UTC 1998


Squeakers,

Steve Burbeck and I  have started having problems in methods where we use
to:do:.
It looks like this in a debugger:
-----------------
fileOutMethodsPerClass
 "File out all method definitions in hierarchy order along with their protocol
organization"

 | protocol selector1 selectors source |
 self fileStream
  nextChunkPut: self envyAppName,' becomeDefault'; cr.
 self classesInHierarchyOrder
  do:[:theClass|
   theClass selectors isEmpty ifFalse:[
   selectors _ theClass selectors asSortedCollection asArray.
   self fileStream
    nextPut:$!;
    nextChunkPut: theClass name,' publicMethods';cr;cr.
   1 to: selectors size do:[:index|
    selector1 _ selectors at: index.
    source _ theClass sourceCodeAt: selector1.
    self fileStream nextPutAll: source.
    index =  selectors size
     ifFalse:[self fileStream nextPut:'!';cr]
     ifTrue:[self fileStream nextPutAll:'! !';cr]].
   selectors do:[:selector|
    protocol _ theClass whichCategoryIncludesSelector: selector.
    self fileStream nextChunkPut: theClass name,' categoriesFor: #',selector,'
are: #(''',protocol,''')';cr]]].
 self fileStream cr
-----------------

The temp vars look like this:

protocol:  nil
selector1:  address
selectors:  (address contents contents: incrementCounter lfsr lfsr: lfsrCounter
lfsrCounter: pnpCard pnpCard: previousContents previousContents: resetLFSR
resetLFSRCounter rotateLFSR updateLFSR )
source:  ITIConfigurationAddressPort
theClass:  1
index:  Text for ''address
 "<^hOf Integer>"
 "answer the fixed address of a configuration address port."

 ^16r0279''
indexLimiT:  16
selector:  nil

-----------------

Note that indexLimiT is added by the Compiler, probably in an attempt to inline
the to:do:.
But notice that the values of temp vars source, theClass and index are mixed
up!

Ouuch!!

We have seen this on several methods in both 1.23 and 1.3.


Sam S. Adams, Distinguished Engineer, IBM Research RTP
tie line 444-0736, outside 919-254-0736, email: ssadams at us.ibm.com
<<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, I Corinthians 1:10>>





More information about the Squeak-dev mailing list