Re: Tracing causes segfault when catching exception

Daniel Diaz <[email protected]> Fri, 19 Sep 2008 11:01:04 +0200
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Hi Jasper

I could reproduce the bug.
I'm investigating where does it come from. It seems -O causes a bad use 
of ebx which is normally reserved for gprolog.
A workaround consists in no using ebx. Configure with:

./configure --disable-regs

It seems OK for me (with gcc 4.1.2)

If not OK can you try with:

./configure --disable-regs --with-c-flags=-O2

Thanks

> Quick follow-up -- I just tried this again, having recompiled gprolog 
> without any C flags, and now the bug does not occur. The following trace 
> output is produced, which is more or less what I would expect...
> 
> | ?- 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 ?
>       2    2  Fail: '$catch'(_17 is text,_16,fail,on_exception,3,true) ?
>       1    1  Fail: on_exception(_16,_17 is text,fail) ?
> 
> no
> {trace}
> | ?-
> 
> ...so it is something to do with compiler optimization.
>     --Jasper
> 
> Jasper Taylor wrote:
>> Hi Daniel,
>>
>> This happens on Ubuntu Linux 8.04 (files are in Windows partition but 
>> that shouldn't matter) on a Macbook with a Core 2 Duo processor. 
>> Because my main problem depends on the flags used to compile gprolog, 
>> I rebuilt it with -O and -O3, and got the problem both times.
>>
>> Here's the gcc version info:
>>
>> $ gcc -v
>> Using built-in specs.
>> Target: i486-linux-gnu
>> Configured with: ../src/configure -v 
>> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr 
>> --enable-shared --with-system-zlib --libexecdir=/usr/lib 
>> --without-included-gettext --enable-threads=posix --enable-nls 
>> --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 
>> --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc 
>> --enable-mpfr --enable-targets=all --enable-checking=release 
>> --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
>> Thread model: posix
>> gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
>>
>> Hope this helps. Let me know if you'd like me to test it in Windows or 
>> MacOS.
>>
>>     --Jasper
>>
>> Daniel Diaz wrote:
>>> Hi Jasper,
>>>
>>> can you give me more information about your architecture (OS, 
>>> compiler, flags used to compiler gprolog,...). BTW it iseems you are 
>>> under win XP, you should avoid spaces in path names (e.g. Program 
>>> Files) because gprolog does not handle those spaces correctly...
>>
>>
>> _______________________________________________
>> Bug-prolog mailing list
>> [email protected]
>> http://lists.gnu.org/mailman/listinfo/bug-prolog
> 
> 
> 
> _______________________________________________
> Bug-prolog mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/bug-prolog
> 


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.