Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006149OCamlOCaml generalpublic2013-08-30 04:542014-07-24 19:38
Reporterhongboz 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version4.01.0+dev 
Target Version4.02.1+devFixed in Version 
Summary0006149: -annot option causes segfault
DescriptionThis is hard to produce since it's based on a preprocessor.
What I observed:

_build>ocamlc.opt -w +a-4-32-30 -c -w -41 -pp 'boot/fan -printer p' -I src -I common -o src/stdFan.cmo src/stdFan.ml
File "src/stdFan.ml", line 6, characters 0-11:
Warning 33: unused open Format.
_build> ocamlc.opt -annot -w +a-4-32-30 -c -w -41 -pp 'boot/fan -printer p' -I src -I common -o src/stdFan.cmo src/stdFan.ml
File "src/stdFan.ml", line 6, characters 0-11:
Warning 33: unused open Format.
Segmentation fault: 11

_build>ocamlc.opt -v
The OCaml compiler, version 4.01.0+dev22-2013-08-20
Standard library directory: /Users/bobzhang/.opam/4.01.0dev+trunk/lib/ocaml
TagsNo tags attached.
Attached Files? file icon marshal_ast.ml [^] (1,067 bytes) 2013-08-30 04:59 [Show Content]

- Relationships
parent of 0005961resolvedfrisch Unused type warnings seem to does not work with the ghost locatoin 

-  Notes
(0010259)
hongboz (developer)
2013-08-30 04:58

Since the source file does not make sense, I uploaded a marshalized ast

_build> ocamlc.opt -annot -w +a-4-32-30 -c -w -41 -o src/stdFan.cmo marshal_ast.ml
File "src/stdFan.ml", line 6, characters 0-11:
Warning 33: unused open Format.
Segmentation fault: 11
_build> ocamlc.opt -w +a-4-32-30 -c -w -41 -o src/stdFan.cmo marshal_ast.ml
File "src/stdFan.ml", line 6, characters 0-11:
Warning 33: unused open Format.
(0010263)
hongboz (developer)
2013-08-30 14:32

It seems to be the location problem
(0010265)
frisch (developer)
2013-08-30 15:18

Can you elaborate? Issue 0005961 gave a proper assert failure, not a segfault.
(0010269)
hongboz (developer)
2013-08-30 16:17

Can you reproduce this behavior on your machine?
I tried ocamlc.opt -annot stdFan_ppo.ml, it works fine.
-----------------------
My experimentation:
First, I exported annotations in typing/stypes.ml

Running the following scripts

let f file =
  Pparse.file Format.std_formatter file Parse.implementation Config.ast_impl_magic_number;;

let file = "/Users/bobzhang/fan/_build/marshal_ast1.ml"
let a = f file

let env = Compmisc.initial_env()
    
let _ = begin

  Clflags.annotations := true;
  Typemod.type_implementation "t.ml" "t" "T" env a;
  Clflags.annotations := false;
  (* Stypes.dump None; *)
end
-------

so far so good, then I access Stypes.annotations in the toplevel, which gives me a segfault.
List.length !Stypes.annotation ==> 2
---
 let v = Obj.repr (List.nth !Stypes.annotations 0);;
val v : Obj.t = <abstr>
# Marshal.to_channel ochan v [];;
Exception: Invalid_argument "output_value: functional value".
(0010270)
hongboz (developer)
2013-08-30 16:20

It seems like Stypes.record is corrupted, but it's not obvious to me
(0010294)
doligez (administrator)
2013-09-02 11:18

I have reproduced the behaviour on my machine with this command line:
   ocamlc -annot -c marshal_ast.ml

- Issue History
Date Modified Username Field Change
2013-08-30 04:54 hongboz New Issue
2013-08-30 04:58 hongboz Note Added: 0010259
2013-08-30 04:59 hongboz File Added: marshal_ast.ml
2013-08-30 14:32 hongboz Relationship added parent of 0005961
2013-08-30 14:32 hongboz Note Added: 0010263
2013-08-30 15:18 frisch Note Added: 0010265
2013-08-30 16:17 hongboz Note Added: 0010269
2013-08-30 16:20 hongboz Note Added: 0010270
2013-09-02 11:18 doligez Note Added: 0010294
2013-09-02 11:18 doligez Status new => confirmed
2013-09-02 11:18 doligez Product Version => 4.01.0+dev
2013-09-02 11:18 doligez Target Version => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-24 19:38 doligez Target Version 4.02.0+dev => 4.02.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker