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

segfault #8310

Closed
vicuna opened this issue Oct 2, 2003 · 3 comments
Closed

segfault #8310

vicuna opened this issue Oct 2, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 2, 2003

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

Bug description

Hello,

J'ai un programme qui segfaulte quand il est compilé avec ocamlc, et
pas ocamlopt. J'utilise toujours la beta 2.

Malheureusement, je n'ai pas de version minimale. Le programme est
gros (c'est le compilateur CDuce), et en dichotomisant, je vois que la
segfault se produit au milieu d'une instruction dans une definition de
modules recursifs. D'ailleurs, c'est simplement l'acces à un champ
d'enregistrement qui est un entier qui provoque la segfaulte.

Je suis quasiment sûr de ne pas utiliser de magouilles avec Obj ou de
marshalling dans la trace d'execution qui plante.

Est-ce qu'un bug corrigé depuis la beta2 pourrait expliquer cela?
Sinon, j'essaierai quand meme de reduire le programme...

-- Alain

@vicuna
Copy link
Author

vicuna commented Oct 3, 2003

Comment author: administrator

On Fri, 3 Oct 2003, Xavier Leroy wrote:

Il n'y a pas eu de changements sur les modules récursifs entre beta 2
et final.

J'ai minimisé:

==a.ml==
module type T = sig type t val f: t -> unit end
module Make(X : T) = struct type t = S of t let rec f (S p) = f p end
module rec Node : sig type t = unit val f: unit -> unit end =
struct type t = unit let f () = () end
and X : T = Make(Node)
and Y : T = Make(Node)

==b.ml==
A.Node.f ()

On linke les deux avec ocamlc, on execute -> segfault.
Si on regarde bien, on voit que c'est le code de Make.f qui est executé au
lieu de Node.f. Pas de soucis avec ocamlopt.

-- Alain

@vicuna
Copy link
Author

vicuna commented Oct 3, 2003

Comment author: administrator

J'ai minimisé:

Voilà un bug bien cerné! Beau travail. Je n'ai pas eu de mal à
trouver le bug, qui est stupide -- de la famille "quand on construit
une liste ordonnée, il faut faire un nombre pair de List.rev".
C'est corrigé dans le CVS (mise à jour de camlcvs dans quelques
heures) et un patch est ci-dessous.

Amitiés,

  • Xavier

Index: csl/bytecomp/translmod.ml
diff -c csl/bytecomp/translmod.ml:1.44 csl/bytecomp/translmod.ml:1.45
*** csl/bytecomp/translmod.ml:1.44 Mon Jul 7 15:42:49 2003
--- csl/bytecomp/translmod.ml Fri Oct 3 16:36:00 2003


*** 10,16 ****
(* *)
(***********************************************************************)

! (* $Id: translmod.ml,v 1.44 2003/07/07 13:42:49 xleroy Exp $ *)

(* Translation from typed abstract syntax to lambda terms,
for the module language )
--- 10,16 ----
(
*)
(***********************************************************************)

! (* $Id: translmod.ml,v 1.45 2003/10/03 14:36:00 xleroy Exp $ *)

(* Translation from typed abstract syntax to lambda terms,
for the module language *)


*** 310,320 ****
transl_module Tcoerce_none (field_path rootpath id) modl,
transl_structure (id :: fields) cc rootpath rem)
| Tstr_recmodule bindings :: rem ->
compile_recmodule
(fun id modl ->
transl_module Tcoerce_none (field_path rootpath id) modl)
bindings
! (transl_structure (map_end fst bindings fields) cc rootpath rem)
| Tstr_modtype(id, decl) :: rem ->
transl_structure fields cc rootpath rem
| Tstr_open path :: rem ->
--- 310,321 ----
transl_module Tcoerce_none (field_path rootpath id) modl,
transl_structure (id :: fields) cc rootpath rem)
| Tstr_recmodule bindings :: rem ->

  •   let ext_fields = List.rev_append (List.map fst bindings) fields in
      compile_recmodule
        (fun id modl ->
          transl_module Tcoerce_none (field_path rootpath id) modl)
        bindings
    

! (transl_structure ext_fields cc rootpath rem)
| Tstr_modtype(id, decl) :: rem ->
transl_structure fields cc rootpath rem
| Tstr_open path :: rem ->

@vicuna
Copy link
Author

vicuna commented Oct 3, 2003

Comment author: administrator

Bug in compilation of recursive modules. Fixed 2003-10-03 by XL.

@vicuna vicuna closed this as completed Oct 3, 2003
@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