Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern matching code crashes interpreter #2834

Closed
vicuna opened this issue Jul 13, 2001 · 1 comment
Closed

pattern matching code crashes interpreter #2834

vicuna opened this issue Jul 13, 2001 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 13, 2001

Original bug ID: 432
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Manuel Fahndrich
Version: 3.01
OS: win2000, x86
Submission from: tide79.microsoft.com (131.107.3.79)

The following code causes the byte code interpreter to crash when run. The
optimizing compiler works fine.

-Maf


type defid = string * int

type t = A of string | B of defid

let trans a b c =
match a,b,c with

| B (name,i), None, `CGuard
| B (name,i), Some ("guard",_), _ ->

  Printf.printf "crashing...\n"; flush stdout;

  Printf.printf "guard case(%s,%d)\n" name i

| _, _, _ ->

  Printf.printf "default case\n"

(* These cases are okay
*)

let _ = trans (A "foo") None `CGuard

let _ = trans (A "foo") None `CRsrc

let _ = trans (B ("baz",22)) None `CRsrc

let _ = trans (A "foo") (Some ("key",1)) `CRsrc

let _ = trans (A "foo") (Some ("guard",2)) `CRsrc

let _ = trans (A "foo") (Some ("cap",3)) `CRsrc

let _ = trans (A "foo") (Some ("key",4)) `CGuard

let _ = trans (A "foo") (Some ("guard",5)) `CGuard

let _ = trans (A "foo") (Some ("cap",6)) `CGuard

let _ = trans (B ("goo",123)) (Some ("key",1)) `CRsrc

let _ = trans (B ("goo",123)) (Some ("cap",3)) `CRsrc

let _ = trans (B ("goo",123)) (Some ("key",4)) `CGuard

let _ = trans (B ("goo",123)) (Some ("cap",6)) `CGuard

(* These cases crash the byte code compiler, but not the optimizing compiler

  • under x86, ocaml 3.01
    *)

let _ = trans (B ("baz",11)) None `CGuard

let _ = trans (B ("goo",123)) (Some ("guard",2)) `CRsrc

let _ = trans (B ("goo",123)) (Some ("guard",5)) `CGuard

@vicuna
Copy link
Author

vicuna commented Jul 13, 2001

Comment author: administrator

Same as fixed-326
--Luc

@vicuna vicuna closed this as completed Jul 13, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant