Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Calling a method of the outermost class from a class defined in a multiple stratum in a method causes a Segfault (LDC2 1.23.0) #3556

Closed
kntroh opened this issue Sep 5, 2020 · 2 comments · Fixed by #3558

Comments

@kntroh
Copy link

kntroh commented Sep 5, 2020

When I compile and run this code, I get a segfault. There was no problem with dmd 2.093.1.

import std.stdio;

class C {
    void func() {
        writeln("hello world!");
    }
    void run1() {
        class C2 {
            class C3 {
                void run3() {
                    func();
                }
            }
            void run2() {
                auto c3 = new C3;
                c3.run3();
            }
        }
        auto c2 = new C2;
        c2.run2();
    }
}

void main() {
    auto c = new C;
    c.run1();
}

Windows 10 Pro (64-bit):

$ ldc2-1.23.0-windows-multilib\bin\ldc2 -run test.d
Error: C:\Users\***\AppData\Local\Temp\test-417097a-fa96f5.exe failed with status: -1073741819
Error: program received signal 1073741819

Linux Mint 19.3 (64-bit):

$ ldc2-1.23.0-linux-x86_64/bin/ldc2 -run test.d
Error: /tmp/test-896560f-8a2e3b failed with status: -2
       message: Segmentation fault (core dumped)
Error: program received signal 2 (Interrupt)
@kinke
Copy link
Member

kinke commented Sep 10, 2020

Thx for the nicely reduced testcase.

@kntroh
Copy link
Author

kntroh commented Sep 11, 2020

Thanks for the fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants