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: 363 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi!
I am using OCaml version 3.01 on Windows 2000. We are working on project
using ocaml as a prototyping language. I had a piece of code, very similar
to this:
type expr =
Var of string
| Literal of int
| Plus of (expr * expr)
| Minus of (expr * expr)
| Times of (expr * expr)
| Divide of (expr * expr)
type stmt =
Assign of (expr * expr)
| Return of (expr)
let rec traverseprog_bad = function res -> function
[] -> res
| (s::ss) -> traverseprog_bad (traversestmt_bad res s) ss
and traversestmt_bad = function res -> function
Assign(Var(v1), Var(v2))
| Assign(Var(v1), Plus(Var(v2), Literal()))
| Assign(Var(v1), Plus(Literal(), Var(v2)))
| Assign(Var(v1), Minus(Var(v2), Literal()))
| Assign(Var(v1), Minus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| _ -> res
let rec traverseprog_good = function res -> function
[] -> res
| (s::ss) -> traverseprog_good (traversestmt_good res s) ss
and traversestmt_good = function res -> function
Assign(Var(v1), Var(v2)) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Plus(Var(v2), Literal())) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Plus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Minus(Var(v2), Literal())) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Minus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| _ -> res
let res_good = traverseprog_good [] prog
let res_bad = traverseprog_bad [] prog
Actually I tried to use the "_bad" solution first, but I got an Application
Error message box (both in ocaml and ocamlwin) with the following error
message: The instuction at "0x0040ad3c" referenced memory at "0x00000001".
The memory could not be "read".
When I tried the "_good" solution it worked without any problem.
Viktor
This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in error,
please notify the sender immediately and delete the original. Any other
use of the email by you is prohibited.
The text was updated successfully, but these errors were encountered:
I am using OCaml version 3.01 on Windows 2000. We are working on project
using ocaml as a prototyping language. I had a piece of code, very similar
to this:
and traversestmt_bad = function res -> function
Assign(Var(v1), Var(v2))
| Assign(Var(v1), Plus(Var(v2), Literal()))
| Assign(Var(v1), Plus(Literal(), Var(v2)))
| Assign(Var(v1), Minus(Var(v2), Literal()))
| Assign(Var(v1), Minus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| _ -> res
Original bug ID: 363
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi!
I am using OCaml version 3.01 on Windows 2000. We are working on project
using ocaml as a prototyping language. I had a piece of code, very similar
to this:
type expr =
Var of string
| Literal of int
| Plus of (expr * expr)
| Minus of (expr * expr)
| Times of (expr * expr)
| Divide of (expr * expr)
type stmt =
Assign of (expr * expr)
| Return of (expr)
let rec traverseprog_bad = function res -> function
[] -> res
| (s::ss) -> traverseprog_bad (traversestmt_bad res s) ss
and traversestmt_bad = function res -> function
Assign(Var(v1), Var(v2))
| Assign(Var(v1), Plus(Var(v2), Literal()))
| Assign(Var(v1), Plus(Literal(), Var(v2)))
| Assign(Var(v1), Minus(Var(v2), Literal()))
| Assign(Var(v1), Minus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| _ -> res
let rec traverseprog_good = function res -> function
[] -> res
| (s::ss) -> traverseprog_good (traversestmt_good res s) ss
and traversestmt_good = function res -> function
Assign(Var(v1), Var(v2)) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Plus(Var(v2), Literal())) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Plus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Minus(Var(v2), Literal())) ->
((v1, v2)::(v2, v1)::res)
| Assign(Var(v1), Minus(Literal(), Var(v2))) ->
((v1, v2)::(v2, v1)::res)
| _ -> res
let prog = [Assign(Var("a"), Literal(2));
Assign(Var("b"), Literal(3));
Assign(Var("c"), Literal(4));
Assign(Var("d"), Plus(Var("a"), Literal(2)));
Assign(Var("e"), Minus(Literal(10), Var("b")));
Assign(Var("f"), Plus(Var("e"), Var("b")));
Return(Var("f"))]
let res_good = traverseprog_good [] prog
let res_bad = traverseprog_bad [] prog
Actually I tried to use the "_bad" solution first, but I got an Application
Error message box (both in ocaml and ocamlwin) with the following error
message: The instuction at "0x0040ad3c" referenced memory at "0x00000001".
The memory could not be "read".
When I tried the "_good" solution it worked without any problem.
Viktor
This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in error,
please notify the sender immediately and delete the original. Any other
use of the email by you is prohibited.
The text was updated successfully, but these errors were encountered: