Thread overview
BUG: silly dmd crash
Dec 23, 2004
h3r3tic
Dec 23, 2004
Simon Buchan
Re: silly dmd crash
Dec 23, 2004
Thomas Kuehne
December 23, 2004
void main()
{
    this.foobar;
}

/+ Shouldn't work. Shouldn't crash DMD. Crashes on my system: DMD .109, WinXP SP2 EN +/
December 23, 2004
h3r3tic wrote:

> void main()
> {
>     this.foobar;
> }
> 
> /+ Shouldn't work. Shouldn't crash DMD. Crashes on my system: DMD .109, WinXP SP2 EN +/

Crashes GDC 0.9 too: (Mac OS X 10.3.7, GCC 3.3.5)

> test.d:0: internal compiler error: Bus error

--anders
December 23, 2004
On Thu, 23 Dec 2004 01:06:18 +0100, h3r3tic <foo@bar.baz> wrote:

> void main()
> {
>     this.foobar;
> }

Confirmed: - gives segfault/memory execption at address 0x40e2ba:
Obviously should give error:
bugtest.d(3): 'this' is only allowed in non-static member functions

Note: not required to be main.

With -v it doesn't even print parse... but there is nothing that could
cause it to fail before printing that, so it must not have been flushed before
the crash. (I suspect that tracking down bugs is kind of the whole point of
printing this info?)

taking a quick peek around:
I am suspicios of expression.c 1182:
    fdthis = sc->parent->isFuncDeclaration();
possible main() scope doesn't have parent (unnamed module) inited? unlikely.

-- 
"Unhappy Microsoft customers have a funny way of becoming Linux,
Salesforce.com and Oracle customers." - www.microsoft-watch.com:
"The Year in Review: Microsoft Opens Up"
--
"I plan on at least one critical patch every month, and I haven't been disappointed."
- Adam Hansen, manager of security at Sonnenschein Nath & Rosenthal LLP
(Quote from http://www.eweek.com/article2/0,1759,1736104,00.asp)
--
"It's been a challenge to "reteach or retrain" Web users to pay for content, said Pizey"
-Wired website: "The Incredible Shrinking Comic"
December 23, 2004
Added to DStress as http://svn.kuehne.cn/dstress/nocompile/this_01.d http://svn.kuehne.cn/dstress/nocompile/this_02.d

Thomas