On Tue, May 29, 2007 at 12:20:21PM +0000, Jan Flokstra wrote:
> Update of /cvsroot/monetdb/pathfinder/modules/pftijah
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10231
> 
> Modified Files:
>       pftijah.mx 
> Log Message:
> - try to repair pftijah "testcoll2" bug on 64bit archs
> 
> 
> 
> Index: pftijah.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/pftijah.mx,v
> retrieving revision 1.123
> retrieving revision 1.124
> diff -u -d -r1.123 -r1.124
> --- pftijah.mx        25 May 2007 12:34:24 -0000      1.123
> +++ pftijah.mx        29 May 2007 12:20:18 -0000      1.124
> @@ -3267,15 +3267,16 @@
>                       return GDK_FAIL;
>                   }
>  
> -                 doc_start = *(oid*)BUNtail(doc_firstpre,r);
> -                 oid tj_nextIndex = tj_docIndex +  1;
> +                 // 64bit ERROR?? doc_start = *(oid*)BUNtail(doc_firstpre,r);
                       ^^^^^^^^^^^^^
No, a bug in the code:
BAT doc_firstpre is [oid,int]., i.e., its tail is int, not oid, and int != oid;
========
pathfinder/modules/pftijah/pftijah.mx-73-.COMMAND pf2tijah_node(
pathfinder/modules/pftijah/pftijah.mx-74-                      BAT[oid,str] 
doc_name,
pathfinder/modules/pftijah/pftijah.mx:75:                      BAT[oid,int] 
doc_firstpre,
                                                               
^^^^^^^^^^^^^^^^^^^^^^^^^
pathfinder/modules/pftijah/pftijah.mx-76-                      BAT[oid,oid] 
pfpre,
pathfinder/modules/pftijah/pftijah.mx-77-                      BAT[oid,oid] 
item,
pathfinder/modules/pftijah/pftijah.mx-78-                      BAT[oid,int] 
kind,
pathfinder/modules/pftijah/pftijah.mx-79-                      BAT[oid,str]  
doc_loaded)
pathfinder/modules/pftijah/pftijah.mx-80-                      : BAT[void,oid] 
= CMDpf2tijah_node;
pathfinder/modules/pftijah/pftijah.mx-81- "Translate Pathfinder node sequence 
to tijah node sequence"
========
hence, to access the tail in C, you (obviously!) need to use
        int doc_start = *(int*) BUNtail(doc_firstpre,r);
        ^^^               ^^^
if (for what ever reason) doc_start needs to be of type oid instead of int, you 
need to use
        oid doc_start = (oid) *(int*) BUNtail(doc_firstpre,r);
        ^^^              ^^^    ^^^
(as you do below);
in fact, you should first check, whether the respective tail value of 
doc_firstpre is 
not negative, before you caat it to oid!
> +                 doc_start = (oid)*(int*)BUNtail(doc_firstpre,r);
> +                 oid tj_nextIndex = tj_docIndex +  (oid)1;
>                   if ( BATcount(doc_firstpre) > tj_nextIndex ) {
>                       r = BUNfnd(doc_firstpre,&tj_nextIndex);
>                       if ( !r ) {
>                           stream_printf(GDKout,"Cannot do range for 
> tijah-firstpre @  %d.\n",tj_docIndex);
>                           return GDK_FAIL;
>                       }
> -                     doc_end = *(oid*)BUNtail(doc_firstpre,r) - 1;
> +                     doc_end = *(oid*)BUNtail(doc_firstpre,r) - (oid)1;

NOPE!
either
        int doc_end = *(int*) BUNtail(doc_firstpre,r) - 1;
or
        oid doc_end = (oid) (*(int*) BUNtail(doc_firstpre,r) - 1);
plus a check, whether *(int*) BUNtail(doc_firstpre,r) is > 0 !


Stefan

>                   } else {
>                       doc_end = oid_nil;
>                   }
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Monetdb-pf-checkins mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
> 
> 

-- 
| Dr. Stefan Manegold | mailto:[EMAIL PROTECTED] |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-developers mailing list
Monetdb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to