Compiler bugs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler bugs

Artur Zaroda
Hello,

One isn't likely to run into these, when writing typical
Smalltalk code. Anyway, here it is:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

None of the following compiles:

"1<2 ifTrue: [] ifFalse: self falseBlock"
"1<2 ifTrue: [[self trueAction]] value"
"1 to: 10 do: [self doBlock] value"

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The code for (and the result of):

"1=(1<2 ifTrue: [1];ifTrue: [1])"

is incorrect.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The code for (and the result of):

"5=(true ifTrue: [5=5 ifTrue: []. 5])"

is incorrect. So is:

"i:=0. 10 timesRepeat: [0 ifTrue: []. i:=i+1]. i"

although here walkback would probably be more appropriate.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Obviously because of the same bug, the following:

"i:=0. [1<2 ifTrue: []. (i:=i+1)<33510] whileTrue"

results in stack overflow signal, but I only get it for
values up to 48869 - after that, there is just GPF
(it could be a Win95 thing, though).

An even easier way to get GPF is:

"1 timesRepeat: [1 ifTrue: []. 1<2]"

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Different bug, but also with stack overflow:

"[] repeat; value"

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The result of the following is incorrect:

"[false] whileTrue; yourself"

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

This is tricky:

"(super) bar"
"super foo;bar"

In both cases Dolphin does normal send of #bar, not supersend.
VW (and ANSI) says, that first one is illegal and second
should supersend both #foo and #bar. Squeak, as always, has
it's own unique way of doing things - the first one is
equivalent to "super bar" and the second one is illegal, so
in each case Dolphin, VW and Squeak give three different
interpretations.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

This:

"1<2 ifFalse: [[] repeat]"

puts compiler in an infinite loop.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Artur Zaroda
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Compiler bugs

Blair McGlashan
Artur

Thanks for the bug reports on the compiler. We are currently working on a
replacement compiler, so it is unlikely that we will be fixing anything but
show stopping bugs in the current compiler (and as it has been with us a
number of years, I don't think there are too many of those still lurking in
there). These obscure cases may, however, be useful in the SUnit tests for
the new compiler :-).

BTW: I've also written a reply to your other recent posting, but it is
currently lodged on my laptop and so won't escape until I next connect it up
to the network.

Regards

Blair

"Artur Zaroda" <[hidden email]> wrote in message
news:[hidden email]...

>
> Hello,
>
> One isn't likely to run into these, when writing typical
> Smalltalk code. Anyway, here it is:
>
> """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> None of the following compiles:
>
> "1<2 ifTrue: [] ifFalse: self falseBlock"
> "1<2 ifTrue: [[self trueAction]] value"
> "1 to: 10 do: [self doBlock] value"
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> The code for (and the result of):
>
> "1=(1<2 ifTrue: [1];ifTrue: [1])"
>
> is incorrect.
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> The code for (and the result of):
>
> "5=(true ifTrue: [5=5 ifTrue: []. 5])"
>
> is incorrect. So is:
>
> "i:=0. 10 timesRepeat: [0 ifTrue: []. i:=i+1]. i"
>
> although here walkback would probably be more appropriate.
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> Obviously because of the same bug, the following:
>
> "i:=0. [1<2 ifTrue: []. (i:=i+1)<33510] whileTrue"
>
> results in stack overflow signal, but I only get it for
> values up to 48869 - after that, there is just GPF
> (it could be a Win95 thing, though).
>
> An even easier way to get GPF is:
>
> "1 timesRepeat: [1 ifTrue: []. 1<2]"
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> Different bug, but also with stack overflow:
>
> "[] repeat; value"
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> The result of the following is incorrect:
>
> "[false] whileTrue; yourself"
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> This is tricky:
>
> "(super) bar"
> "super foo;bar"
>
> In both cases Dolphin does normal send of #bar, not supersend.
> VW (and ANSI) says, that first one is illegal and second
> should supersend both #foo and #bar. Squeak, as always, has
> it's own unique way of doing things - the first one is
> equivalent to "super bar" and the second one is illegal, so
> in each case Dolphin, VW and Squeak give three different
> interpretations.
>
> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> This:
>
> "1<2 ifFalse: [[] repeat]"
>
> puts compiler in an infinite loop.
>
> """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
>
> Artur Zaroda
> [hidden email]
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Compiler bugs

Dave Harris-3
[hidden email] (Blair McGlashan) wrote (abridged):
> We are currently working on a replacement compiler

In Smalltalk? Will it be part of the usual sources? Cool.

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      [hidden email]      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."


Reply | Threaded
Open this post in threaded view
|

Re: Compiler bugs

Blair McGlashan
Dave

"Dave Harris" <[hidden email]> wrote in message
news:[hidden email]...
> [hidden email] (Blair McGlashan) wrote (abridged):
> > We are currently working on a replacement compiler
>
> In Smalltalk? Will it be part of the usual sources? Cool.

Yes and yes.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

New Compiler (was: Compiler bugs)

Hasko Heinecke
"Blair McGlashan" <[hidden email]> wrote
> > > We are currently working on a replacement compiler
> >
> > In Smalltalk? Will it be part of the usual sources? Cool.
>
> Yes and yes.

Will it include VW-like features such as automatic temp var insertion and
name correction? I guess, at least it could be added then.

Hasko


Reply | Threaded
Open this post in threaded view
|

Re: New Compiler (was: Compiler bugs)

Ernest Micklei-2
and what about sourcecode formatting with style options
such that blocks are indented nicely?  :-)

Ernest

Hasko Heinecke <[hidden email]> wrote in message
news:[hidden email]...

>
> "Blair McGlashan" <[hidden email]> wrote
> > > > We are currently working on a replacement compiler
> > >
> > > In Smalltalk? Will it be part of the usual sources? Cool.
> >
> > Yes and yes.
>
> Will it include VW-like features such as automatic temp var insertion and
> name correction? I guess, at least it could be added then.
>
> Hasko
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: New Compiler (was: Compiler bugs)

jWarrior
Ernest Micklei <[hidden email]> wrote in message
news:9c18n2$5ih0s$[hidden email]...
> and what about sourcecode formatting with style options
> such that blocks are indented nicely?  :-)

that will be added to a future (soon) version of the Refactoring Browser.

>
> Ernest
>
> Hasko Heinecke <[hidden email]> wrote in message
> news:[hidden email]...
> >
> > "Blair McGlashan" <[hidden email]> wrote
> > > > > We are currently working on a replacement compiler
> > > >
> > > > In Smalltalk? Will it be part of the usual sources? Cool.
> > >
> > > Yes and yes.
> >
> > Will it include VW-like features such as automatic temp var insertion
and

> > name correction? I guess, at least it could be added then.
> >
> > Hasko
> >
> >
> >
> >
> >
>
>


Reply | Threaded
Open this post in threaded view
|

Re: New Compiler (was: Compiler bugs)

Bill Schwab-2
In reply to this post by Ernest Micklei-2
> and what about sourcecode formatting with style options
> such that blocks are indented nicely?  :-)

My preference would be to have the ability to control color syntax
highlighting (something I always want) independent of automated formatting
(something I almost never want).  AFAIK, Squeak has these combined in an all
or nothing system, and it can get a little annoying - sometimes it even goes
so far as to delete parts of the source code.  The stuff that Squeak's
pretty printing deletes has no effect on the code, but, it does cause
interfere with my system of calling attention to things that need work.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]