jckarter / clay

The Clay programming language
http://claylabs.com/clay
Other
403 stars 34 forks source link

Compiling with -g doesn't work at all #453

Closed Blei closed 11 years ago

Blei commented 11 years ago

Even the tiniest program fails with something like:

% clay -g blob.clay
Intrinsic result type is not an integer type.
i8* (i8*, i8*)* @llvm.expect.p0i8
Intrinsic result type is not an integer type.
i8* (i8*, i8*)* @llvm.expect.p0i8
Broken module found, compilation aborted!
Stack dump:
0.      Running pass 'Module Verifier' on function '@clayglobals_init'
zsh: abort      clay -g blob.clay

llvm & clang are at 3.1.

jckarter commented 11 years ago

I think this might be an LLVM bug, because llvm.expect seems to work fine with pointer types in an asserts-disabled build. You could work around it by hacking Clay's hints module to overload likely and unlikely to bitcast pointer inputs to integers before passing them through the intrinsic.

jckarter commented 11 years ago

Actually, it looks like it's the expect calls created by exception handling code in the compiler that are tripping that assertion. Those can be ripped out.

Blei commented 11 years ago

Well, the documentation of the LLVM IR here seems to say that only i32 and i64 types are legal. I guess that works out for pointers if the type is not checked at all, but doesn't hold up if it is.

Blei commented 11 years ago

The documentation seems to be incorrect, it works for any integer type, but not for pointers, at least according to the Intrinsic.td file.

Blei commented 11 years ago

Are you still on that? Because it looks like I might have a fix.

jckarter commented 11 years ago

It's all yours.

ghost commented 11 years ago

Fixed by @Blei in issue #454.