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

segmentaion fault (core dumped) in Objective Caml 3.01 #2822

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

segmentaion fault (core dumped) in Objective Caml 3.01 #2822

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

Comments

@vicuna
Copy link

vicuna commented Jul 1, 2001

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

Bug description

Hello!

I have a problem with following code:

let rec reverse_merge x =
match x with
| ([], [], out) -> out
| (h::t, [], out)
| ([], h::t, out) -> reverse_merge(t, [], h::out)
| (h1::t1, h2::t2, out) ->
if h1 > h2
then reverse_merge (t1, h2::t2, h1::out)
else reverse_merge (h1::t1, t2, h2::out)
;;

let _ =
reverse_merge ([1; 5; 7; 20; 40; 67], [0; 4; 4; 77; 666], [])
;;

While this one works fine:

let rec reverse_merge x =
match x with
| ([], [], out) -> out
| (h::t, [], out) -> reverse_merge(t, [], h::out)
| ([], h::t, out) -> reverse_merge(t, [], h::out)
| (h1::t1, h2::t2, out) ->
if h1 > h2
then reverse_merge (t1, h2::t2, h1::out)
else reverse_merge (h1::t1, t2, h2::out)
;;

let _ =
reverse_merge ([1; 5; 7; 20; 40; 67], [0; 4; 4; 77; 666], [])
;;

PS. Objective Caml 3.01 at Black Cat Linux (2.2.11-4bc), installed from sources
distribution.

WBR, Ilya S Slyzhnyak. e-mail: ilya666@mail.kz icq: 33099817

@vicuna
Copy link
Author

vicuna commented Jul 2, 2001

Comment author: administrator

Hello!
Hello, tkank you for your interset in Caml.

I have a problem with following code:

let rec reverse_merge x =
match x with

    ....
| (h::t, [], out)
| ([], h::t, out) -> reverse_merge(t, [], h::out)
    ....

Here it hurts.

This is a known bug of ocamlc (aka byte-code compiler) : it does silly
things when a or-pattern includes strictly more than 1 variable.

Not that,

  1. The bug does not affect ocamlopt.
  2. The bug is corrected in the development sources.

It you care for more details,
please look under number 326 in the ocaml bug tracking system.
http://caml.inria.fr/bin/caml-bugs/fixed?id=326;page=18;user=guest

Anyway, thank you again reporting this bug.

--Luc

@vicuna vicuna closed this as completed Jul 2, 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