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

unsafe cast via polymorphic exception #4002

Closed
vicuna opened this issue Apr 12, 2006 · 2 comments
Closed

unsafe cast via polymorphic exception #4002

vicuna opened this issue Apr 12, 2006 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 12, 2006

Original bug ID: 4002
Reporter: sumii
Status: closed (set by @garrigue on 2006-04-18T00:03:45Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 3.09.1
Category: typing
Has duplicate: #4179
Monitored by: sumii @alainfrisch @mmottl

Bug description

Credit due to some students in Tokyo... (Sorry, I read their blogs but don't know their real names.)

$ ledit ocaml
Objective Caml version 3.09.1

exception Ex of _ ;;

exception Ex of 'a

let mymagic x =

try
  raise (Ex x)
with
  Ex(x) -> x

;;
val mymagic : 'a -> 'b =

print_int (mymagic (1,2));;

121358- : unit = ()

print_int (mymagic (1,2));;

112900- : unit = ()

print_int (mymagic (1,2));;

104442- : unit = ()

print_int (mymagic (1,2));;

95984- : unit = ()

print_int (mymagic (1,2));;

153058- : unit = ()

print_float (mymagic 1);;

Bus error
$

@vicuna
Copy link
Author

vicuna commented Apr 17, 2006

Comment author: Pasinelli

I have reproduced it on my computer as well with different values and types (strings and floats) but I did not manage to raise a Bus Error. The version running on my PC is 3.06.

@vicuna
Copy link
Author

vicuna commented Apr 18, 2006

Comment author: @garrigue

Fixed in typing/typetexp.ml (CVS release309)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant