Version française
Home     About     Download     Resources     Contact us    
Browse thread
Bug with camlp5 and Bigarray Access
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joseph Young <josyoun@r...>
Subject: Bug with camlp5 and Bigarray Access
 	Camlp5 does not appear to handle bigarray access correctly. 
Consider the following program:

let y=Bigarray.Array2.create Bigarray.float64 Bigarray.fortran_layout 5 3;;
let z=y.{1,1};;

This program compiles correctly with:

$ ocamlc bigarray.cma bug.ml -o bug

When I preprocess with camlp5o using the command:

$ ocamlc -I +camlp5 -pp camlp5o bigarray.cma bug.ml -o bug,

I receive the error:

File "bug.ml", line 2, characters 6-7:
This expression has type
   (float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array2.t
but is here used with type ('a, 'b, 'c) Bigarray.Array1.t

This only appears to be a problem with camlp5o.  Using camlp5r and the 
program:

value y=Bigarray.Array2.create Bigarray.float64 Bigarray.fortran_layout 5 
3;
value z=y.{1,1};

This appears to compile correctly:

$ ocamlc -I +camlp5 -pp camlp5r bigarray.cma bug2.ml -o bug2

Also, when I preprocess the original file using pr_o, things seem to work 
correctly:

camlp5 pa_o.cmo pa_op.cmo pr_o.cmo bug.ml > tmp.ml
ocamlc bigarray.cma tmp.ml -o tmp

Joe