[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-bugtracker] Bug #3250: jit causes segfault when passed an error rasied by a non fast is pased through a fast function


http://gambaswiki.org/bugtracker/edit?object=BUG.3250&from=L21haW4-

Comment #1 by Brian G:

# Gambas JIT: errors raised in or near compiled code

Two problems with errors and the JIT compiler, found while working on the sharedmem library.
Both work correctly with the JIT turned off (`GB_NO_JIT=1`).

Gambas version: 3.22.99, master, commits 5877e93bb and d1c27f9a9 (both show the problems).
System: Linux x86_64, gcc used by gb.jit.

## 1-lost-error: an error raised after a Try is lost

`Store._put` is compiled (`Fast Unsafe`). Inside a `Try`, it calls a method of an interpreted class
through `Object.Call`, and that method raises an error. The `Try` catches it. `_put` then raises a new
error. That error is lost: the `Catch` of `_put` does not get it, and neither does the `Try` of the
caller. The program stops.

Expected (`GB_NO_JIT=1`):

    caught: again: Out of bounds

With the JIT:

    gbx3: error: Store._put.15: again: Out of bounds
    Stack backtrace
       1: Store._put.15
       2: Store._put.14
       3: Main.Main.7

The same code works with the JIT when the method behind `Object.Call` is compiled too. It also works
when the interpreted method catches its own error and returns the error text, and the compiled `_put`
then raises it.



----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----