caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Bug with camlp5 and Bigarray Access
@ 2008-02-19 19:32 Joseph Young
  2008-02-20  2:20 ` [Caml-list] " Daniel de Rauglaudre
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Young @ 2008-02-19 19:32 UTC (permalink / raw)
  To: caml-list

 	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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Bug with camlp5 and Bigarray Access
  2008-02-19 19:32 Bug with camlp5 and Bigarray Access Joseph Young
@ 2008-02-20  2:20 ` Daniel de Rauglaudre
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel de Rauglaudre @ 2008-02-20  2:20 UTC (permalink / raw)
  To: caml-list

Hi

On Tue, Feb 19, 2008 at 01:32:18PM -0600, Joseph Young wrote:

> 	Camlp5 does not appear to handle bigarray access correctly. 

This is a bug indeed. I fixed it some days ago. It will be ok at next
Camlp5 release.

In the meantime, to fix it locally, you can edit the file "etc/pa_o.ml"
and around line 582, change:
      | e = SELF; "."; "{"; el = V (LIST1 expr SEP ","); "}" ->
into:
      | e = SELF; "."; "{"; el = V (LIST1 expr LEVEL "+" SEP ","); "}" ->

-- 
Daniel de Rauglaudre
http://pauillac.inria.fr/~ddr/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-20  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 19:32 Bug with camlp5 and Bigarray Access Joseph Young
2008-02-20  2:20 ` [Caml-list] " Daniel de Rauglaudre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).