Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006443OCamlOCaml tools (ocaml{lex,yacc,dep,browser,debug})public2014-05-26 15:372014-05-27 16:07
ReporterReventlov 
Assigned Togarrigue 
PrioritynormalSeveritycrashReproducibilitysometimes
StatusresolvedResolutionfixed 
PlatformLinuxOSArchlinuxOS VersionUp to date.
Product Version4.01.0 
Target VersionFixed in Version4.02.0+dev 
Summary0006443: Ocaml segfault when List.fold_left is traced then executed
DescriptionIn the ocaml toplevel, when launching List.fold_left after tracking List.fold_left, you get a crash (segfault).
Steps To ReproduceOpen the toplevel ocaml, type trace List.fold_left;; then type
List.fold_left;;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0011571)
gasche (developer)
2014-05-26 15:45
edited on: 2014-05-26 15:46

Could reproduce on 4.01 and trunk. Crashes on List.map as well (but not for List.filter, List.rev or Array.fold_left).

(0011572)
dim (developer)
2014-05-26 16:12

This crashes as well:

# #trace List.fold_left;;
List.fold_left is now traced.
# 0;;
Segmentation fault

# #trace Toploop.use_file;;
Toploop.use_file is now traced.
# 0;;
- : int = 0
# #use "foo.ml";;
Segmentation fault

It seems to be the case for any function used by the compiler/toplevel.
(0011573)
azynheira (reporter)
2014-05-26 16:18

Hi,
I am on MacOSX 10.9.3 and can reproduce this as well.
(0011575)
garrigue (manager)
2014-05-27 13:24

This is a rather strange one.
I could localize the breakage between in trunk at revision 11123,
namely when merging the changes from 3.12.0 to 3.12.1 into trunk.
Note that 3.12.1 doesn't exhibit this behavior, so this looks like a merge problem.

Still looking for the cause.
(0011576)
garrigue (manager)
2014-05-27 15:17

I eventually found the cause.
It was not commit 11123, but 11102.
This is a "small optimization" by Luc, reduces let-expressions whose body is the variable itself, to allow more tail-calls.
It is supposed to be always correct.
However, there is one pitfall: this is precisely the idiom used in trace.ml to prevent a tail call...
(0011578)
garrigue (manager)
2014-05-27 16:07

Fixed in version/4.02 at revision 14922.
Replaced the optimized away let-expansion by a try-with, which cannot be optimized away without heavy static analysis... Should be safe for a while.

- Issue History
Date Modified Username Field Change
2014-05-26 15:37 Reventlov New Issue
2014-05-26 15:45 gasche Note Added: 0011571
2014-05-26 15:45 gasche Status new => confirmed
2014-05-26 15:46 gasche Note Edited: 0011571 View Revisions
2014-05-26 16:12 dim Note Added: 0011572
2014-05-26 16:18 azynheira Note Added: 0011573
2014-05-27 13:24 garrigue Note Added: 0011575
2014-05-27 15:17 garrigue Note Added: 0011576
2014-05-27 16:07 garrigue Note Added: 0011578
2014-05-27 16:07 garrigue Status confirmed => resolved
2014-05-27 16:07 garrigue Fixed in Version => 4.02.0+dev
2014-05-27 16:07 garrigue Resolution open => fixed
2014-05-27 16:07 garrigue Assigned To => garrigue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker