You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6523 Reporter:@yallop Assigned to:@mshinwell Status: resolved (set by @mshinwell on 2014-08-29T10:52:14Z) Resolution: open Priority: urgent Severity: block Fixed in version: 4.02.0+dev Category: otherlibs Related to:#6064
Bug description
$ cat ba_char.ml
let b = Bigarray.(Array1.create char c_layout 1) in
let c = '\128' in
begin
b.{0} <- c;
assert (b.{0} = c)
end;;
print_endline "ok";
$ ocamlc unix.cma bigarray.cma ba_char.ml -o ba_char && ./ba_char
Fatal error: exception File "ba_char.ml", line 5, characters 2-8: Assertion failed
Native code is fine, since it uses bigarray intrinsics:
$ ocamlopt unix.cmxa bigarray.cmxa ba_char.ml -o ba_char && ./ba_char
ok
The top-level crashes, since it assumes char can't hold negative values:
$ ocaml
OCaml version 4.02.0+dev16-2014-08-21
#load "unix.cma";;
#load "bigarray.cma";;
let b = Bigarray.(Array1.create char c_layout 1);;
val b :
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t =
Nitpick: owing to the use of the C 'char' type (instead of 'unsigned char'), char bigarray elements were treated EITHER as signed OR as unsigned depending on the platform. End of nitpick.
Original bug ID: 6523
Reporter: @yallop
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2014-08-29T10:52:14Z)
Resolution: open
Priority: urgent
Severity: block
Fixed in version: 4.02.0+dev
Category: otherlibs
Related to: #6064
Bug description
$ cat ba_char.ml
let b = Bigarray.(Array1.create char c_layout 1) in
let c = '\128' in
begin
b.{0} <- c;
assert (b.{0} = c)
end;;
print_endline "ok";
$ ocamlc unix.cma bigarray.cma ba_char.ml -o ba_char && ./ba_char
Fatal error: exception File "ba_char.ml", line 5, characters 2-8: Assertion failed
Native code is fine, since it uses bigarray intrinsics:
$ ocamlopt unix.cmxa bigarray.cmxa ba_char.ml -o ba_char && ./ba_char
ok
The top-level crashes, since it assumes char can't hold negative values:
$ ocaml
OCaml version 4.02.0+dev16-2014-08-21
#load "unix.cma";;
#load "bigarray.cma";;
let b = Bigarray.(Array1.create char c_layout 1);;
val b :
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t =
b.{0} <- '\128';;
b.{0};;
Segmentation fault
File attachments
The text was updated successfully, but these errors were encountered: