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

compiler crash with vibe.d project #1022

Closed
Laeeth opened this issue Aug 16, 2015 · 17 comments
Closed

compiler crash with vibe.d project #1022

Laeeth opened this issue Aug 16, 2015 · 17 comments

Comments

@Laeeth
Copy link

Laeeth commented Aug 16, 2015

Hi.

I am afraid I haven't time to minimize this or to check it compiles under dmd 2.066. It does compile under GDC 5.2.0 however. I am using 64 bit arch linux and:
DUB version 0.9.24-rc.1, built on Jun 28 2015

Project is dicebot's refinement of the vibe.d blog framework. I just modified it to compile with ldc - a few changes to imports, and stuck in the source from phobos for lineSplitter and chunkBy. Possibly I have done something stupid, but I suppose it shouldn't be a compiler crash (and it does compile under gdc).

This commit:
Laeeth/mood@6d4a0cf

Error:
[laeeth@engine mood]$ dub build --compiler=ldc
Target vibe-d 0.7.24 is up to date. Use --force to rebuild.
Building mood 1.0.0+commit.7.g6d4a0cf configuration "application", build type debug.
Running ldc...
Compiling diet template 'pages/new_post.dt'...
Compiling diet template 'pages/index.dt'...
Compiling diet template 'pages/single_post.dt'...
0 ldc 0x00000000012335f2 llvm::sys::PrintStackTrace(IO_FILE) + 34
1 ldc 0x00000000012316a3
2 libpthread.so.0 0x00007f55099a0d60
3 ldc 0x00000000006ea97f
4 ldc 0x00000000006eb6e3 IrAggr::addFieldInitializers(llvm::SmallVectorImplllvm::Constant_&, std::map<VarDeclaration*, llvm::Constant*, std::less<VarDeclaration*>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, AggregateDeclaration_, unsigned int&, bool) + 707
5 ldc 0x00000000006ebc74 IrAggr::createInitializerConstant(std::map<VarDeclaration_, llvm::Constant_, std::less<VarDeclaration_>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, llvm::StructType_) + 164
6 ldc 0x00000000006ec0c7 IrAggr::getDefaultInit() + 119
7 ldc 0x0000000000732ba8
8 ldc 0x0000000000732f33
9 ldc 0x0000000000732b83
10 ldc 0x000000000073373e Declaration_codegen(Dsymbol_) + 46
11 ldc 0x00000000006c5b19 codegenModule(IRState_, Module_, bool) + 137
12 ldc 0x000000000059b631 ldc::CodeGenerator::emit(Module*) + 177
13 ldc 0x000000000057690b main + 10395
14 libc.so.6 0x00007f5508b72610 __libc_start_main + 240
15 ldc 0x0000000000594365
FAIL .dub/build/application-debug-linux.posix-x86_64-ldc_0-C05D3549AE4AB8B05B0DC5D87C3AB16A/ mood executable
Error executing command build:
ldc failed with exit code -11.

@redstar
Copy link
Member

redstar commented Aug 16, 2015

Which ldc version do you use? (Output of ldc2 -version).

@Laeeth
Copy link
Author

Laeeth commented Aug 17, 2015

oh - hadn't thought system used beta. sorry for not noticing. I can
try with the stable before that if helpful.
LDC - the LLVM D compiler (0.15.2-beta2):
based on DMD v2.066.1 and LLVM 3.6.1
Default target: x86_64-unknown-linux-gnu
Host CPU: core-avx2
http://dlang.org - http://wiki.dlang.org/LDC
Registered Targets:
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
On Sun, 2015-08-16 at 07:36 -0700, Kai Nacke wrote:

Which ldc version do you use? (Output of ldc2 -version).

Reply to this email directly or view it on GitHub.

@redstar
Copy link
Member

redstar commented Aug 22, 2015

Confirmed. Happens with version from master, too.

@redstar
Copy link
Member

redstar commented Sep 20, 2015

I am trying to check this with ldc2 0.16.0-alpha4 but I get a compile error:

no property `chunkBy` for type `const(BlogPost[])`

@Laeeth
Copy link
Author

Laeeth commented Sep 20, 2015

You will need to copy and paste chunkBy from Phobos since it isn't yet in the library for LDC, I think. That should have been included in my commit (along with version(LDC) which calls that code rather than Phobos if dmd is not used).

@Laeeth
Copy link
Author

Laeeth commented Sep 20, 2015

Using ldc alpha 3 and git head for mood. I think it's alpha 3 and misreporting its version as 0.15.1, but I could be wrong.

Fast-forward
LICENSE | 23 +++
source/mood/api/implementation.d | 6 +-
source/mood/util/compat.d | 364 +++++++++++++++++++++++++++++++++++++++
views/blocks/aside.dt | 2 +-
4 files changed, 391 insertions(+), 4 deletions(-)
create mode 100644 LICENSE
create mode 100644 source/mood/util/compat.d
[laeeth@engine mood]$ dub build --compiler=ldc
Performing "debug" build using ldc for x86_64.
vibe-d 0.7.24: target for configuration "libevent" is up to date.
mood 1.0.0+commit.2.g905fc78: building configuration "application"...
Compiling diet template 'pages/new_post.dt'...
Compiling diet template 'pages/index.dt'...
Compiling diet template 'pages/single_post.dt'...
0 ldc 0x0000000001641b82 llvm::sys::PrintStackTrace(IO_FILE) + 50
1 ldc 0x00000000016415b4
2 libpthread.so.0 0x00007f14da590d60
3 ldc 0x0000000000789a4f
4 ldc 0x000000000078b093 IrAggr::addFieldInitializers(llvm::SmallVectorImplllvm::Constant_&, std::map<VarDeclaration*, llvm::Constant*, std::less<VarDeclaration*>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, AggregateDeclaration_, unsigned int&, bool) + 739
5 ldc 0x000000000078b5e2 IrAggr::createInitializerConstant(std::map<VarDeclaration_, llvm::Constant_, std::less<VarDeclaration_>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, llvm::StructType_) + 162
6 ldc 0x000000000078ba4a IrAggr::getDefaultInit() + 154
7 ldc 0x0000000000755988
8 ldc 0x0000000000755f13
9 ldc 0x0000000000755963
10 ldc 0x00000000007567ee Declaration_codegen(Dsymbol_) + 62
11 ldc 0x0000000000744d85 Module::genLLVMModule(llvm::LLVMContext&) + 501
12 ldc 0x000000000060c4ea main + 6858
13 libc.so.6 0x00007f14d92df610 __libc_start_main + 240
14 ldc 0x000000000062df79 _start + 41
ldc failed with exit code -11.

@Laeeth
Copy link
Author

Laeeth commented Sep 20, 2015

upgraded to ldc alpha 4.
master of this link https://github.com/dprop-developers/mood.git
had to hack the code a bit as LDC stiill doesn't have chunkyby but it does now have split function that conflicts with the compatibility code.

I also put in the align(16) for atomicStore and used vibe master as release notes suggest. not sure if I did it right.

still compiler crash:

[laeeth@engine mood]$ dub build --compiler=ldc2
Package vibe-d can be upgraded from ~master to 0.7.24.
Use "dub upgrade" to perform those changes.
WARNING: A deprecated branch based version specification is used for the dependency vibe-d. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
Performing "debug" build using ldc2 for x86_64.
vibe-d ~master: target for configuration "libevent" is up to date.
mood 1.0.0+commit.3.g9f84d46: building configuration "application"...
Compiling diet template 'pages/new_post.dt'...
Compiling diet template 'pages/index.dt'...
Compiling diet template 'pages/single_post.dt'...
0 ldc2 0x00000000012716e2 llvm::sys::PrintStackTrace(IO_FILE) + 34
1 ldc2 0x000000000126f793
2 libpthread.so.0 0x00007f92a117fd60
3 ldc2 0x0000000000728c3f
4 ldc2 0x00000000007296ff IrAggr::addFieldInitializers(llvm::SmallVectorImplllvm::Constant_&, std::map<VarDeclaration*, llvm::Constant*, std::less<VarDeclaration*>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, AggregateDeclaration_, unsigned int&, bool) + 687
5 ldc2 0x0000000000729d74 IrAggr::createInitializerConstant(std::map<VarDeclaration_, llvm::Constant_, std::less<VarDeclaration_>, std::allocator<std::pair<VarDeclaration* const, llvm::Constant*> > > const&, llvm::StructType_) + 164
6 ldc2 0x000000000072a237 IrAggr::getDefaultInit() + 119
7 ldc2 0x0000000000771048
8 ldc2 0x00000000007713d3
9 ldc2 0x0000000000771bde Declaration_codegen(Dsymbol_) + 46
10 ldc2 0x000000000070b1f9 codegenModule(IRState_, Module_, bool) + 137
11 ldc2 0x00000000005d6491 ldc::CodeGenerator::emit(Module*) + 177
12 ldc2 0x00000000005b1aeb main + 10507
13 libc.so.6 0x00007f92a06d3610 __libc_start_main + 240
14 ldc2 0x00000000005cf811
ldc2 failed with exit code -11.

@redstar
Copy link
Member

redstar commented Sep 20, 2015

After the library update I get the error again.

@redstar
Copy link
Member

redstar commented Sep 20, 2015

This is somewhat complicated to reduce. My current command line is:

ldc2 -c -d-version=Have_vibe_d -Isource/ -IC:\Users\Kai\AppData\Roaming\dub\packages\vibe-d-0.7.24\source source/mood/api/implementation.d source/mood/storage/generic_cache.d

The problem is related to initialization of Cache. The initializer has no type(!) and causes the error.

@Laeeth
Copy link
Author

Laeeth commented Sep 20, 2015

Sorry for my ignorance, but what does 'the initializer has no type'
mean?
I see the below:
shared immutable(CacheData!TEntry)* data = new CacheData!TEntry;

Laeeth.
On Sun, 2015-09-20 at 12:44 -0700, Kai Nacke wrote:

This is somewhat complicated to reduce. My current command line is:
ldc2 -c -d-version=Have_vibe_d -Isource/
-IC:\Users\Kai\AppData\Roaming\dub\packages\vibe-d-0.7.24\source
source/mood/api/implementation.d source/mood/storage/generic_cache.d
The problem is related to initialization of Cache. The initializer
has no type(!) and causes the error.

Reply to this email directly or view it on GitHub.

@dnadlinger
Copy link
Member

It's rather certainly a frontend bug, where it either does not run semantic analysis on the variable or does not fully resolve the type. It's not expected to occur in normal operation, and as such the error message does not make much sense.

@Laeeth
Copy link
Author

Laeeth commented Sep 22, 2015

Thanks for the colour.

@Laeeth
Copy link
Author

Laeeth commented Sep 22, 2015

Btw the code compiled with dmd often crashes, although dicebot cannot replicate. My guess is something to do with the atomic operations on the cache.

@redstar
Copy link
Member

redstar commented Sep 22, 2015

Do you properly align the data used with atomic operations?

@Laeeth
Copy link
Author

Laeeth commented Sep 25, 2015

It's his code, not mine. (I started writing my own fork to do things a bit more simply, as I don't really need the sophistication/efficiency, and it's pushing at boundaries of my knowledge at this stage - my last low level work was Z80 embedded). But I tried putting an align(16) before the relevant struct and it didn't seem to help..

@kinke
Copy link
Member

kinke commented Nov 24, 2016

Should be fixed by #1891.

@kinke
Copy link
Member

kinke commented May 12, 2018

Closing this as part of housekeeping, looks very much like a dead end.

@kinke kinke closed this as completed May 12, 2018
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

4 participants