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 static ubyte16 definition #419

Closed
mleise opened this issue Jun 30, 2013 · 4 comments
Closed

Compiler crash with static ubyte16 definition #419

mleise opened this issue Jun 30, 2013 · 4 comments
Assignees

Comments

@mleise
Copy link
Contributor

mleise commented Jun 30, 2013

import core.simd;
static ubyte16 v = ['a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'];

This crashes the compiler (LLVM 3.3) for me on Linux x64:

0  ldc2            0x00000000011bc0d2 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  ldc2            0x00000000011bb701
2  libpthread.so.0 0x0000003fe1c10410
3  ldc2            0x00000000007945ca stripModifiers(Type*) + 16
4  ldc2            0x00000000007865f8 DtoType(Type*) + 25
5  ldc2            0x00000000007d0c99 DtoConstArrayInitializer(ArrayInitializer*) + 380
6  ldc2            0x00000000007933eb DtoConstInitializer(Loc, Type*, Initializer*) + 482
7  ldc2            0x00000000007c6c2d VarDeclaration::codegen(Ir*) + 1181
8  ldc2            0x00000000007c7252 AttribDeclaration::codegen(Ir*) + 128
9  ldc2            0x000000000076d136 Module::genLLVMModule(llvm::LLVMContext&, Ir*) + 920
...
@redstar
Copy link
Member

redstar commented Jun 30, 2013

Crashes LDC head and LLVM 3.4 trunk, too.
The Type * value passed to stripModifiers() is 0.

@ghost ghost assigned redstar Jun 30, 2013
redstar added a commit to redstar/ldc that referenced this issue Jul 1, 2013
The vector type was not handled in `DtoConstArrayInitializer()`.
@redstar
Copy link
Member

redstar commented Jul 1, 2013

The vector type is not considered in DtoConstArrayInitializer(). This results in a null value for elemty which causes the crash.

@mleise
Copy link
Contributor Author

mleise commented Jul 1, 2013

What's the recommended way to use a ubyte16 vector of a compile-time known scalar at the moment?
As far as I can tell the fastest option is to have one "prepared" somewhere in the data segment of the program, but I need at least the flexibility to create them during CTFE. So I wrote a template that would declare static, immutable ubyte16's and ran into this and also another problem about cast(vector)cast(ubyte)0u not being const. But I'll first look and see if this already fixes it.

@redstar
Copy link
Member

redstar commented Jul 1, 2013

Well, currently I can't recommend something. But your approach looks reasonable to me.

The const problem looks a bit like http://d.puremagic.com/issues/show_bug.cgi?id=10312.

@redstar redstar closed this as completed Jul 7, 2013
redstar pushed a commit that referenced this issue Sep 27, 2014
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