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

ICE with extern(C++) #927

Closed
TurkeyMan opened this issue May 8, 2015 · 9 comments
Closed

ICE with extern(C++) #927

TurkeyMan opened this issue May 8, 2015 · 9 comments

Comments

@TurkeyMan
Copy link

1>d\ud\platform\dbg.d(28): Error: variable ud.platform.dbg.S.s ICE: C++ static non- __gshared non-extern variables not supported
1>Assertion failed: 0, file D:\OpenSource\ldc\ldc-release\dmd2\cppmangle.c, line 298

ICE with popup error dialog probably not the best way to inform the user of the problem here:

extern (C++):

struct S
{
  static int s;
}
  • Latest MSVC LDC
@TurkeyMan
Copy link
Author

That said, it would be nice if TLS variables were supported with extern (C++), since this actually is a C++ struct I'm trying to link against.

@redstar
Copy link
Member

redstar commented May 31, 2015

Same as #928 and #929. We really need to fix the frontend here.

@TurkeyMan
Copy link
Author

Any comment on the extern to C++ TLS?
Know if DMD has plans to support this? Can LDC support it? Is it LLVM that handles TLS?

@dnadlinger
Copy link
Member

It is likely just an arbitrary restriction in the frontend because nobody has needed it so far. We should definitely be able to implement it in LDC. LLVM does the TLS handling for us, we only need to get the C++ mangling correct. As for DMD: @yebblies?

@TurkeyMan
Copy link
Author

Just to be clear, the static in the struct above is deliberately a TLS; it is declared __thread in the C++ counterpart.

@TurkeyMan
Copy link
Author

And it raises the question, is the LLVM MSVC support compatible with MSC's TLS?
Ie, __declspec(thread) in MSVC terms.

@redstar
Copy link
Member

redstar commented Jun 28, 2015

There is no special name mangling with thread local variables in Visual C++. LLVM uses the same approach as Visual C++ therefore LDC should be compatible with MSC's TLS.
I look if I can enable the support.

@TurkeyMan
Copy link
Author

Cool. I'm surprised they don't mangle differently, there must be some serious ABI difference for TLS from extern "C"?

@dnadlinger
Copy link
Member

These errors do not crash the compiler any longer. To actually add support for further parts of C++, the changes should go into the upstream frontend first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants