Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #261 (closed defect: fixed)

Opened 15 years ago

Last modified 12 years ago

Assertion `v' failed.

Reported by: mrmonday Assigned to: lindquist
Priority: major Milestone: Delay
Component: frontend (both) Version: hg tip
Keywords: Cc:

Description

When compiling:

class A {
        void method(char[] f) {}
}
static this() {
        (new A).method!()("foo");
}

with

LLVM D Compiler rev. 1255:9014d7f0433f (2009-04-22 03:08 +0200)
based on DMD v1.042 and llvm 2.5 (2009-03-03 04:36:03 +0000)

on linux x86-64, I get the following assertion:

ldc: /home/robert/d/comp/ldc/gen/toir.cpp:1172: virtual DValue* ThisExp::toElem(IRState*): Assertion `v' failed.
0   ldc       0x0000000000cecdd1
1   libc.so.6 0x00007f6dde202150
2   libc.so.6 0x00007f6dde2020c5 gsignal + 53
3   libc.so.6 0x00007f6dde2035e3 abort + 387
4   libc.so.6 0x00007f6dde1fb0e9 __assert_fail + 233
5   ldc       0x000000000064722e ThisExp::toElem(IRState*) + 366
6   ldc       0x000000000064c1a2 AssertExp::toElem(IRState*) + 98
7   ldc       0x00000000006373f6 ExpStatement::toIR(IRState*) + 86
8   ldc       0x0000000000637249 CompoundStatement::toIR(IRState*) + 89
9   ldc       0x0000000000615683 DtoDefineFunction(FuncDeclaration*) + 1763
10  ldc       0x00000000006642e9 Ir::emitFunctionBodies() + 57
11  ldc       0x000000000065e7f9 Module::genLLVMModule(Ir*) + 633
12  ldc       0x000000000062396b main + 4891
13  libc.so.6 0x00007f6dde1ee546 __libc_start_main + 230
14  ldc       0x0000000000546e39

Change History

04/22/09 19:23:44 changed by mrmonday

Side note: This compiles fine with dmd 1.043 on linux x86-32

04/27/09 01:45:06 changed by lindquist

taking care of the FIXME at gen/toir:1170 will most likely fix this, but it's too late right now to try.

04/27/09 10:32:02 changed by lindquist

This is invalid code, and that it's accepted is a frontend bug. Try looking at the mangle of A.method with and without the template call syntax in the static ctor:

(new A).method!()("foo");
->
_D3bar12_staticCtor1FZv6methodMFAaZv

vs.

(new A).method("foo");
->
_D3bar1A6methodMFAaZv

04/27/09 11:03:08 changed by lindquist

  • owner changed from ChristianK to lindquist.
  • component changed from unspecified to frontend (both).
  • milestone set to Delay.

06/03/12 00:12:34 changed by klickverbot

  • status changed from new to closed.
  • resolution set to fixed.

Upstream bug has been fixed in the meantime.

Copyright © 2008, LDC Development Team.