Tracing causes segfault when catching exception

Jasper Taylor <[email protected]> Tue, 16 Sep 2008 16:28:55 +0100
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Hi all. I am trying to pin down some aberrant behaviour in gprolog which 
only occurs when built with -O3 c flags. It occurs in a big application 
and I don't want to report it until I can produce it with a compact 
example, so I am trying to use 'trace' to see what is going wrong.

Now I have run into the problem that 'trace' causes a segfault when 
'catch' is used to get an exception within a program. Here is a script 
that shows the problem. The file 'excp.pl' contains this definition:

on_exception(Error, Goal, Recovery) :-
         catch(Goal, Error, Recovery).

...and the session goes...

$ gprolog
GNU Prolog 1.3.1
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?- consult(excp).
compiling /WinXP/Program Files/Simile/Test/excp.pl for byte code...
/WinXP/Program Files/Simile/Test/excp.pl compiled, 2 lines read - 472 
bytes written, 9 ms

(4 ms) yes
| ?- on_exception(B, A is text, fail).

no
| ?- trace.
The debugger will first creep -- showing everything (trace)

yes
{trace}
| ?- on_exception(B, A is text, fail).
       1    1  Call: on_exception(_16,_17 is text,fail) ?
       2    2  Call: '$catch'(_17 is text,_16,fail,on_exception,3,true) ?
       3    3  Call: _17 is text ?
       3    3  Exception: _17 is text ?

Fatal Error: Segmentation Violation
       2    2  Fail: '$catch'(_17 is text,$

...any help will be much appreciated!
	--Jasper