caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joseph Young <josyoun@rice.edu>
To: caml-list@inria.fr
Subject: Bug with camlp5 and Bigarray Access
Date: Tue, 19 Feb 2008 13:32:18 -0600 (CST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0802191320310.24767@echinuz.oplink.net> (raw)

 	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


             reply	other threads:[~2008-02-19 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 19:32 Joseph Young [this message]
2008-02-20  2:20 ` [Caml-list] " Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0802191320310.24767@echinuz.oplink.net \
    --to=josyoun@rice.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).