Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Assertion triggered with separate compilation of interface methods #3496

Closed
jpiles opened this issue Jul 6, 2020 · 1 comment
Closed

Assertion triggered with separate compilation of interface methods #3496

jpiles opened this issue Jul 6, 2020 · 1 comment

Comments

@jpiles
Copy link

jpiles commented Jul 6, 2020

When doing separate compilation, if an interface method is declared but not implemented it triggers an Assertion:

This happens both with static and with final methods:

void bar() {
    I.foo;
}

interface I {
    static void foo();
}
void bar() {
    (new class I{}).foo;
}

interface I {
    final void foo();
}

Trying to compile either version of the code with ldc2 -c a.d triggers:

ldc2: /build/ldc-h5SR24/ldc-1.21.0/ir/irfunction.cpp:79: llvm::Function* IrFunction::getLLVMCallee() const: Assertion `func != nullptr' failed.

Both versions compile properly using dmd and gdc. Tried with debian sid ldc:

LDC - the LLVM D compiler (1.21.0):
  based on DMD v2.091.1 and LLVM 9.0.1
  built with LDC - the LLVM D compiler (1.21.0)
  Default target: x86_64-pc-linux-gnu
  Host CPU: znver1
  http://dlang.org - http://wiki.dlang.org/LDC

and also on run.dlang.io with the same results.

kinke added a commit to kinke/ldc that referenced this issue Jul 10, 2020
…declared functions

Whenever we need an IR function, we'd better make sure it exists. Handle
that in DtoCallee(), by invoking DtoDeclareFunction() by default,
instead of the previous DtoResolveFunction() + DtoCallee() combo.
DtoResolveFunction() usually declares the function, but somehow doesn't
for abstract and body-less functions.
kinke added a commit that referenced this issue Jul 13, 2020
…ions (#3503)

Whenever we need an IR function, we'd better make sure it exists. Handle
that in DtoCallee(), by invoking DtoDeclareFunction() by default,
instead of the previous DtoResolveFunction() + DtoCallee() combo.
DtoResolveFunction() usually declares the function, but somehow doesn't
for abstract and body-less functions.
@kinke
Copy link
Member

kinke commented Jul 14, 2020

Thx for the report.

@kinke kinke closed this as completed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants