We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
0.10.0-dev.1756+17631cb2d
With CXX set to either g++ or zig c++:
CXX
g++
zig c++
$ cat library.hpp void throws_exception(); $ cat library.cpp #include "library.hpp" void throws_exception() { throw 1; } $ cat binary.cpp include "library.hpp" #include <iostream> int main() { try { throws_exception(); } catch (int e) { std::cout << "caught " << e << std::endl; } } $ $CXX -shared -o liblibrary.dylib -I. library.cpp $ $CXX binary.cpp -I. -L. -llibrary $ DYLD_LIBRARY_PATH=. ./a.out
The program should output "caught 1"
With CXX=g++:
CXX=g++
$ DYLD_LIBRARY_PATH=. ./a.out caught 1
With CXX=zig c++:
CXX=zig c++
$ DYLD_LIBRARY_PATH=. ./a.out Segmentation fault: 11
LLDB output:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00000001002e20c7 liblibrary.dylib`__cxxabiv1::readEncodedPointer(unsigned char const**, unsigned char, unsigned long) + 279 liblibrary.dylib`__cxxabiv1::readEncodedPointer: -> 0x1002e20c7 <+279>: movq (%rax), %rax 0x1002e20ca <+282>: jmp 0x1002e20ce ; <+286> 0x1002e20cc <+284>: xorl %eax, %eax 0x1002e20ce <+286>: movq %r9, (%rdi) Target 0: (a.out) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) * frame #0: 0x00000001002e20c7 liblibrary.dylib`__cxxabiv1::readEncodedPointer(unsigned char const**, unsigned char, unsigned long) + 279 frame #1: 0x00000001002e17d0 liblibrary.dylib`__gxx_personality_v0 + 304 frame #2: 0x00007ff822498bf9 libunwind.dylib`_Unwind_RaiseException + 233 frame #3: 0x00000001002e110c liblibrary.dylib`__cxa_throw + 108 frame #4: 0x00000001002df7ed liblibrary.dylib`throws_exception() at library.cpp:4:2 [opt] frame #5: 0x0000000100000f03 a.out`main at binary.cpp:6:3 [opt] frame #6: 0x00000001000ea51e dyld`start + 462
On an aarch64 Linux host, instead of segfaulting I just see
libc++abi: terminating with uncaught exception of type int Aborted
The text was updated successfully, but these errors were encountered:
Perhaps #10892 is also related.
Sorry, something went wrong.
No branches or pull requests
Zig Version
0.10.0-dev.1756+17631cb2d
Steps to Reproduce
With
CXX
set to eitherg++
orzig c++
:Expected Behavior
The program should output "caught 1"
Actual Behavior
With
CXX=g++
:With
CXX=zig c++
:LLDB output:
On an aarch64 Linux host, instead of segfaulting I just see
The text was updated successfully, but these errors were encountered: