Very strange bug on Streams and probably compiler

Damien Cassou damien.cassou at laposte.net
Wed Feb 14 15:18:31 UTC 2007


Execute the following piece of code:


"-------------------------------------------------------------------"
|stream stream2|
stream := WriteStream with: 'a test '.
stream reset.
stream nextPutAll: 'to test'.
self assert: [stream contents = 'to test'].

"On the following line, you can remove 'copy'"
"the problem is present without. It's here to prevent"
" the streams from using the same collection"
"because the compiler tries to avoid creating 2 identical"
"strings"
stream2 := WriteStream with: 'a test ' copy.
stream2 nextPutAll: 'to test'.

"This assert passes but this is abnormal"
self assert: [stream2 contents = 'to testto test'].

"This assert pass and this is abnormal too"
"because the strings MUST be equal !!"
self assert: [stream2 contents ~= 'a test to test']
"-------------------------------------------------------------------"



On my image, all the 3 tests pass. This is completely abnormal in my  
opinion.
In the second test, where does 'to testto test' come from ???

VM:
Squeak VM version: 3.9-8 #2 Tue Oct 10 21:41:34 PDT 2006 gcc 4.0.1
Built from: Squeak3.9alpha of 4 July 2005 [latest update: #7021]
Build host: Darwin margaux 8.8.0 Darwin Kernel Version 8.8.0: Fri  
Sep  8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power  
Macintosh powerpc
default plugin location: /usr/local/lib/squeak/3.9-8/*.so

Image: squeak-dev-76

I will try with other images and the new compiler and let you know.

Can you test with your system please and let us know?

Bye

-- 
Damien Cassou



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070214/db7b5276/attachment.htm


More information about the Squeak-dev mailing list