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

The same name for an argument and a value of a class may cause a segfault. #4435

Closed
vicuna opened this Issue Oct 27, 2007 · 1 comment

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Oct 27, 2007

Original bug ID: 4435
Reporter: jm
Status: closed (set by @garrigue on 2007-10-29T03:17:08Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 3.10+dev
Fixed in version: 3.10+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: jm

Bug description

Here initializer uses the class value [v] (defined after)
instead of the argument value [v]. Which causes a trivial segfault:
% ocaml
Objective Caml version 3.10.1+dev0 (2007-05-21)

class c v = object initializer print_endline v val v = 42 end;;

class c : string -> object val v : int end

new c "42";;

zsh: segmentation fault ocaml

Same thing for methods:
% ocaml
Objective Caml version 3.10.1+dev0 (2007-05-21)

class c v = object method m = print_endline v val v = 42 end;;

class c : string -> object val v : int method m : unit end

let c = new c "42";;

val c : c =

c#m;;

zsh: segmentation fault ocaml

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Oct 29, 2007

Comment author: @garrigue

Fixed in branch release310 (bytecomp/transclass.ml, stdlib/camlinternalOO.ml)
Implicit instance variables should not be treated as normal instance variables.

@vicuna vicuna closed this Oct 29, 2007

@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
You can’t perform that action at this time.