Bug 2067 – call from anonymous class makes access violation.

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2008-05-04T16:30:00Z
Last change time
2014-02-24T15:33:19Z
Assigned to
bugzilla
Creator
benoit

Comments

Comment #0 by benoit — 2008-05-04T16:30:49Z
module test; extern(C) int printf(char*,...); class I { abstract void callI(); } class Base { int index; } class C : Base { void test1(){ printf( "ok\n" ); } void test(){ auto i = new class() I { public void callI() { test1(); if( index is -1 ){ // Access to the outer-super-field triggers the bug test1(); } } }; i.callI(); } } void main () { auto c = new C; c.test(); }
Comment #1 by benoit — 2008-05-04T16:33:13Z
changing if( index is -1 ){ into if( this.outer.index is -1 ){ and the runtime error goes away.
Comment #2 by jarrett.billingsley — 2008-05-04T21:41:47Z
I can't reproduce that fix, Frank. It still segfaults. However, this bug only manifests with GDC. It works fine with DMDWin. See http://d.puremagic.com/issues/show_bug.cgi?id=1669. Should this bug be marked as a duplicate?
Comment #3 by benoit — 2008-05-05T18:12:23Z
I can reproduce it with DMD 1.029 on windows+linux. I cannot say about GDC. This is a regression, so i don't think it is related to GDC. Test on Windows with DMD: F:\dwt-samples>g:\dmd-1.029\dmd\bin\dmd test.d F:\dwt-samples>test Error: Access Violation F:\dwt-samples>g:\dmd-1.028\dmd\bin\dmd test.d F:\dwt-samples>test ok Test on linux ubuntu 8.04 with dmd: frank@lingurke:~/dwt/dwt-samples$ ~/dmd-1.029/dmd/bin/dmd test.d frank@lingurke:~/dwt/dwt-samples$ ./test Segmentation fault frank@lingurke:~/dwt/dwt-samples$ ~/dmd-1.028/dmd/bin/dmd test.d frank@lingurke:~/dwt/dwt-samples$ ./test ok
Comment #4 by benoit — 2008-05-17T18:10:41Z
Now DMD 1.030 is out and this minimal example works, but real program with this scenario still crash. I found a modification of the original test case that crashes on 1.030 but not on 1.029 and 1.028. module test; extern(C) int printf(char*,...); class I { public abstract void callI(); } class C { private int index; void test1(){ printf( "ok\n" ); } I test(){ auto i = new class() I { public void callI() { test1(); } }; return i; } } void main () { auto c = new C; auto i = c.test(); i.callI(); }
Comment #5 by bugzilla — 2008-05-22T05:03:37Z
Fixed dmd 1.030 and 2.014
Comment #6 by benoit — 2008-05-23T12:48:54Z
(In reply to comment #5) > Fixed dmd 1.030 and 2.014 > Hm, so i have put the new test case into a new bug report. See #2123