fix severe bug in indexing of floating point numbers

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1110 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-07-29 18:15:19 +00:00
parent 07686320f5
commit 2a93a01f1c
3 changed files with 23 additions and 14 deletions

View File

@ -11,8 +11,11 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2004-07-23 19:01:14 $,$Author: vsc $ * * Last rev: $Date: 2004-07-29 18:15:18 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.93 2004/07/23 19:01:14 vsc
* fix bad ref count in expand_clauses when copying indexing block
*
* Revision 1.92 2004/06/29 19:04:42 vsc * Revision 1.92 2004/06/29 19:04:42 vsc
* fix multithreaded version * fix multithreaded version
* include new version of Ricardo's profiler * include new version of Ricardo's profiler
@ -2096,13 +2099,16 @@ move_next(ClauseDef *clause, UInt regno)
case _glist_valy: case _glist_valy:
return; return;
case _get_atom: case _get_atom:
case _get_float:
case _get_longint:
case _get_bigint:
if (wreg == cl->u.xc.x) { if (wreg == cl->u.xc.x) {
clause->CurrentCode = NEXTOP(cl,xc); clause->CurrentCode = NEXTOP(cl,xc);
} }
return; return;
/*
matching is not guaranteed:
case _get_float:
case _get_longint:
case _get_bigint:
*/
case _get_struct: case _get_struct:
if (wreg == cl->u.xf.x) { if (wreg == cl->u.xf.x) {
clause->CurrentCode = NEXTOP(cl,xf); clause->CurrentCode = NEXTOP(cl,xf);
@ -2381,11 +2387,14 @@ skip_to_arg(ClauseDef *clause, PredEntry *ap, UInt argno, int at_point)
case _unify_l_list: case _unify_l_list:
case _unify_atom: case _unify_atom:
case _unify_l_atom: case _unify_l_atom:
case _unify_longint: /*
case _unify_l_longint: unification is not guaranteed
case _unify_bigint: case _unify_longint:
case _unify_l_bigint: case _unify_l_longint:
case _unify_l_float: case _unify_bigint:
case _unify_l_bigint:
case _unify_l_float:
*/
case _unify_struct: case _unify_struct:
case _unify_l_struc: case _unify_l_struc:
if (cl == clause->u.WorkPC) { if (cl == clause->u.WorkPC) {

View File

@ -3760,7 +3760,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
int (* f_putc)(int, int); int (* f_putc)(int, int);
int has_tabs; int has_tabs;
jmp_buf format_botch; jmp_buf format_botch;
void *old_handler; volatile void *old_handler = NULL;
volatile int old_pos; volatile int old_pos;
if (Stream[sno].status & InMemory_Stream_f) { if (Stream[sno].status & InMemory_Stream_f) {
@ -4085,7 +4085,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
fstr = NULL; fstr = NULL;
} }
if (Stream[sno].status & InMemory_Stream_f) { if (Stream[sno].status & InMemory_Stream_f) {
old_handler = Stream[sno].u.mem_string.error_handler; Stream[sno].u.mem_string.error_handler = old_handler;
} }
format_clean_up(format_base, fstr, targs); format_clean_up(format_base, fstr, targs);
Yap_JumpToEnv(ball); Yap_JumpToEnv(ball);
@ -4193,7 +4193,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
fstr = NULL; fstr = NULL;
} }
if (Stream[sno].status & InMemory_Stream_f) { if (Stream[sno].status & InMemory_Stream_f) {
old_handler = Stream[sno].u.mem_string.error_handler; Stream[sno].u.mem_string.error_handler = old_handler;
} }
format_clean_up(format_base, fstr, targs); format_clean_up(format_base, fstr, targs);
return FALSE; return FALSE;
@ -4216,7 +4216,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
if (tnum <= 8) if (tnum <= 8)
targs = NULL; targs = NULL;
if (Stream[sno].status & InMemory_Stream_f) { if (Stream[sno].status & InMemory_Stream_f) {
old_handler = Stream[sno].u.mem_string.error_handler; Stream[sno].u.mem_string.error_handler = old_handler;
} }
format_clean_up(format_base, fstr, targs); format_clean_up(format_base, fstr, targs);
return (TRUE); return (TRUE);

View File

@ -48,7 +48,7 @@ typedef struct stream_desc
char *buf; /* where the file is being read from/written to */ char *buf; /* where the file is being read from/written to */
Int max_size; /* maximum buffer size (may be changed dynamically) */ Int max_size; /* maximum buffer size (may be changed dynamically) */
Int pos; Int pos;
void *error_handler; volatile void *error_handler;
} mem_string; } mem_string;
struct { struct {
#if defined(__MINGW32__) || _MSC_VER #if defined(__MINGW32__) || _MSC_VER