Divide by zero error Program ended with exit code: 0
However, when I try to compile essentially the same code in Julia (with Cxx), I see the following ERROR:In file included from :1:
This is primarily a Cxx.jl issue, though you might run into problem if you're trying to unwind through non-C++ frames later.
void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap, RemapFlags Flags) { // Remap operands. for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) { Value *V = MapValue(*op, VMap, Flags); // If we aren't ignoring missing entries, assert that something happened. if (V != 0) *op = V; else assert((Flags & RF_IgnoreMissingEntries) && "Referenced value not in value map!"); }
Keno - I got a little ahead of myself with my last post. While exception handling works fine in several examples, after adding the lines to bootstrap.cpp, I now get a nasty error from Clang when using OpenCV functions that require casting with RTTI (i.e., dyne_cast) . Such OpenCV functions worked before adding the exception handling flags to bootstrap.cpp.e.g.,julia> img = imread(filename) # => here it must convert a const char* to const String&Assertion failed: ((Flags & RF_IgnoreMissingEntries) && "Referenced value not in value map!"), function RemapInstruction, file /Users/maximilianosuster/julia-v0.4.0/deps/llvm-svn/lib/Transforms/Utils/ValueMapper.cpp, line 194.The error can be eliminated by commenting out the following line (and not the others):clang_compiler->getLangOpts().Exceptions = 1; // exception handlingThis is the function that the error refers to in Transforms/Utils/ValueMapper.cppvoid llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap, RemapFlags Flags) { // Remap operands. for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) { Value *V = MapValue(*op, VMap, Flags); // If we aren't ignoring missing entries, assert that something happened. if (V != 0) *op = V; else assert((Flags & RF_IgnoreMissingEntries) && "Referenced value not in value map!"); }I tried to understand what is going on, but AFAIK Clang has its own built-in RTTI and its not entirely clear to me why switching on exceptions in bootstrap.cpp compromises the casting of const char* to String& reference. I tried enabling RTTI =1 and RTTIData = 1 in bootstrap.cpp and removed the -fno-rtti flag from the BuildBootsrap.Makefile. This generated a fatal ERROR upon Pkg.build("Cxx").Any thoughts on what is going on?
Lex - thanks for the tip on the use of exceptions. The immediate aim is to simply avoid crashing the julia REPL every time Clang does not like something in the C++ function arguments. I would prefer eventually to transfer most error checking/exception handling to Julia, but there are cases where some algorithms are best executed in C++.
Without knowing the context where the map is created and modified, is it possible that a previous caught exception has left the map in a questionable state or failed to add an entry when it terminated some function that wasn't expecting exceptions?
// clang_compiler->getLangOpts().Exceptions = 1; // exception handling