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

Nested context type mismatch -> ICE when building vibe.d #739

Closed
dnadlinger opened this issue Oct 10, 2014 · 2 comments · Fixed by #740
Closed

Nested context type mismatch -> ICE when building vibe.d #739

dnadlinger opened this issue Oct 10, 2014 · 2 comments · Fixed by #740

Comments

@dnadlinger
Copy link
Member

Another nested context problem when building vibe.d (from the 0.7.21-rc.2 Git tag):

~/vibe-d-0.7.21-rc.2/source $ ldc2 vibe/db/mongo/connection.d vibe/http/router.d
ldc2: llvm/lib/IR/Instructions.cpp:2377: static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
0  ldc2            0x0000000001b8d361 llvm::sys::PrintStackTrace(_IO_FILE*) + 38
1  ldc2            0x0000000001b8d5d9
2  ldc2            0x0000000001b8cf69
3  libpthread.so.0 0x00007ff14ecf0200
4  libc.so.6       0x00007ff14d8bf967 gsignal + 55
5  libc.so.6       0x00007ff14d8c0d3a abort + 362
6  libc.so.6       0x00007ff14d8b88ad
7  libc.so.6       0x00007ff14d8b8962
8  ldc2            0x0000000001a413a5 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) + 87
9  ldc2            0x0000000000c4a08d
10 ldc2            0x0000000000c494f4
11 ldc2            0x0000000000c475c4 DtoBitCast(llvm::Value*, llvm::Type*, char const*) + 163
12 ldc2            0x0000000000d52edf DtoCallFunction(Loc&, Type*, DValue*, Array<Expression*>*, llvm::Value*) + 1970
13 ldc2            0x0000000000d42bbe
14 ldc2            0x0000000000b132ec
15 ldc2            0x0000000000d4d62a toElem(Expression*) + 69
16 ldc2            0x0000000000d4db94 toElemDtor(Expression*) + 710

Dustmite is running on this right now.

@dnadlinger
Copy link
Member Author

Fairly minimal testcase in terms of non-Phobos code:

module router;
struct MatchTree
{
        struct TerminalTag {}
        TerminalTag[] m_terminalTags;

        void print()
        {
                import std.algorithm;
                import std.array;
                m_terminalTags.map!(t => "").array;
        }
}
module bson;
import std.algorithm;

Build as

ldc2 bson.d router.d

The other way round, the issues does not appear.

@dnadlinger
Copy link
Member Author

Another round of Dustmite and some more manual simplification later:

module algorithm;
import range;

template map(fun...) {
    auto map(Range)(Range) {
        return MapResult!(fun, Range)();
    }
}

struct MapResult(alias fun, R) {
    R _input;
    MapResult opSlice() {
        return MapResult();
    }
}
module range;
void array(Range)(Range r) {}
module router;
import algorithm;
import range;

struct MatchTree {
    struct TerminalTag {}
    TerminalTag[] m_terminalTags;

    void print() {
        m_terminalTags.map!(t => "").array;
    }
}
ldc2 -c algorithm.d router.d

dnadlinger added a commit to dnadlinger/ldc that referenced this issue Oct 11, 2014
This fixes a regression introduced in caa2f15. The IrDsymbol
metadata is obviously reset in between modules, while IrTypes
are not. Thus, we can never set symbol metadata when resolving
types, as the symbol data will be wrong in all modules following
the one where the type was first resolved.

GitHub: Fixes ldc-developers#739.
dnadlinger added a commit to ldc-developers/dmd-testsuite that referenced this issue Oct 11, 2014
dnadlinger added a commit to ldc-developers/dmd-testsuite that referenced this issue Oct 12, 2014
dnadlinger added a commit that referenced this issue Oct 12, 2014
Added test cases for GitHub issues #662 and #739.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant