There is a bug in the new driver.

println$ "Hello";
assert false;

Hello
terminate called after throwing an instance of 'flx::rtl::flx_assert_failure_t'
Shell terminated by signal SIGABRT

~/felix>echo $?
2

I am not printing that message (the system: either clang or the gnu
library if that's what I'm using, its hard to tell) is doing it.

However Felix is SUPPOSED to call this:

void print_loc(FILE *ef,flx_range_srcref_t x,char const *cf, int cl)
{
   fprintf(ef,"Felix location: %s %d[%d]-%d[%d]\n",
    x.filename,
    x.startline,
    x.startcol,
    x.endline,
    x.endcol
  );
  fprintf(ef,"C++ location  : %s %d\n", cf, cl);
}

and it decodes Felix exceptions with this:

int ::flx::rtl::flx_exception_handler (flx_exception_t const *e)
{
....
  if (flx_assert_failure_t const *x = dynamic_cast<flx_assert_failure_t 
const*>(e))
  {
    fprintf(stderr,"Assertion Failure\n");
    print_loc(stderr,x->flx_loc,x->cxx_srcfile, x->cxx_srcline);
    return 3;
  }
...

The call is in the driver:

   try {
    // We're all set up, so run felix
    world->begin_flx_code();

    // Run the felix usercode.
    world->run_until_complete();

    world->end_flx_code();

    error_exit_code = world->teardown();
  }
  catch (flx_exception_t &x) { error_exit_code = flx_exception_handler(&x); }
  catch (std::exception &x) { error_exit_code = std_exception_handler (&x); }
  catch (...)
  {
    fprintf(stderr, "flx_run driver ends with unknown EXCEPTION\n");
    error_exit_code = 4;
  }

In my test GUI I am actually getting:

Unknown EXCEPTION!
~/felix>echo $?
0

which is known to be a Felix exception:

 else
  {
    fprintf(stderr,"Unknown EXCEPTION!\n");
    return 5;
  }

This is all very weird! So I linked statically and sure enough

THE BUG IS IN CLANG.

Assertion Failure
Felix location: 
/Users/johnskaller/felix/build/release/share/lib/gui/__init__.flx 249[5]-249[26]
C++ location  : 
/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/demos/sdl/tgui.cpp 
680

I'm not surprised. Gcc used to have this bug too, but it was fixed.
Identifying exceptions that transit dynamic loading boundaries is non-trvial.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to