Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-02-19 (19:34)
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 -o bug

When I preprocess with camlp5o using the command:

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

I receive the error:

File "", 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 

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

This appears to compile correctly:

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

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

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