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

Bad compilation of classes yields segfault #4821

Closed
vicuna opened this issue Jun 12, 2009 · 2 comments
Closed

Bad compilation of classes yields segfault #4821

vicuna opened this issue Jun 12, 2009 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 12, 2009

Original bug ID: 4821
Reporter: @alainfrisch
Status: closed (set by @garrigue on 2009-06-12T12:43:26Z)
Resolution: fixed
Priority: normal
Severity: crash
Fixed in version: 3.11.1+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Consider this piece of code:

class c = object(this)
method m = ignore (this :> < m: unit; m: unit >)
end

let () = (new c) # m

The call to the method yields a segfault (or something similar).

The code generator produces a call to CamlinternalOo.make_class with an array of method being [| "m"; "m" |]. The explicit coercion should probably be rejected (and it is indeed rejected if we use an immediate object rather than a class). Or maybe the type expression (with a duplicated method name) itself should be rejected?

@vicuna
Copy link
Author

vicuna commented Jun 12, 2009

Comment author: @alainfrisch

The problem is probably in the type checker. The signature inferred for the class is:

class c : object method m : unit method m : unit end

@vicuna
Copy link
Author

vicuna commented Jun 12, 2009

Comment author: @garrigue

Fixed in CVS branch 3.11: there was no check at all that the same method name was not used twice!

Unfortunately, it looks like this is a few hours late for makinf it into 3.11.1.

@vicuna vicuna closed this as completed Jun 12, 2009
@vicuna vicuna added the bug label Mar 20, 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