Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004517OCamlOCaml generalpublic2008-03-03 02:582010-04-29 14:25
ReporterMartin Jambon 
Assigned Tomaranget 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.1 
Target VersionFixed in Version3.11+dev 
Summary0004517: segmentation fault in ocamllex-generated program
DescriptionProgram below ends with a segfault. Haven't found a shorter version.

Small variations in the program can make it work or not (ending with an exception would be fine). The behavior appears to be the same for a given program regardless of the ocaml version (3.09.3 or 3.10.1). Same behavior is observed with bytecode and native code.

$ uname -a
Linux martin 2.6.23-gentoo-r3 #2 SMP Tue Jan 15 23:08:34 CET 2008 x86_64 AMD Turion(tm) 64 X2 Mobile Technology TL-50 AuthenticAMD GNU/Linux

$ cat toto.mll
(*
  Here's the full program.
  Compile with:

  ocamllex toto.mll
  ocamlc -g -o toto.run -rectypes toto.ml
  ocamlopt -o toto -rectypes toto.ml

  Run it without arguments.
*)

let x = [^' ']* as x
let y = 'A'? ' '

rule line = parse
  | "====" x y { line lexbuf }
  | "===" x y { line lexbuf }
  | "==" x y { line lexbuf }
  | "=" x y { line lexbuf }
  | "{{{" x y { verbatim [x] lexbuf }
  | x y { line lexbuf }

and verbatim accu = parse
    "}}}" y { ignore (List.rev accu) }
  | x y { verbatim (x :: accu) lexbuf }

{
  let _ = line (Lexing.from_string "{{{ }}} ")
}
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004463)
Martin Jambon (reporter)
2008-03-03 03:09

The -rectypes flag is superfluous.

Here's a slightly shorter version of the program:

let x = [^' ']* as x
let y = 'A'? ' '

rule line = parse
  | "====" x y { () }
  | "===" x y { () }
  | "==" x y { () }
  | "=" x y { () }
  | "{{{" x y { verbatim [x] lexbuf }
  | x y { line lexbuf }

and verbatim accu = parse
    "}}}" y { ignore (List.rev accu) }
  | x y { verbatim (x :: accu) lexbuf }

{
  let _ = line (Lexing.from_string "{{{ }}} ")
}
(0004467)
doligez (administrator)
2008-03-07 13:14
edited on: 2008-03-07 13:27

Doesn't crash with 3.10.2 on x86.
Doesn't crash with 3.10.1 on x86 either.

Seems to be a 64-bit related problem.

(0004468)
maranget (manager)
2008-03-07 14:21
edited on: 2008-03-07 16:30

This is indeed a bug of ocamllex, which I managed to reproduce with all recent ocaml versions (including 3.10.2 on AMD64).

--
Luc

(0004470)
maranget (manager)
2008-03-07 16:25

Bug corrected in HEAD.

--Luc
(0004471)
maranget (manager)
2008-03-07 16:29

Bug partly due to the imperative nature of ocamllex code.
Corrected in HEAD of cvs, which I assume to be 3.11+dev

--Luc

- Issue History
Date Modified Username Field Change
2008-03-03 02:58 Martin Jambon New Issue
2008-03-03 03:09 Martin Jambon Note Added: 0004463
2008-03-07 13:14 doligez Note Added: 0004467
2008-03-07 13:27 doligez Note Edited: 0004467
2008-03-07 13:28 doligez Status new => acknowledged
2008-03-07 14:21 maranget Note Added: 0004468
2008-03-07 14:23 maranget Note Edited: 0004468
2008-03-07 14:23 maranget Status acknowledged => assigned
2008-03-07 14:23 maranget Assigned To => maranget
2008-03-07 16:25 maranget Note Added: 0004470
2008-03-07 16:29 maranget Status assigned => resolved
2008-03-07 16:29 maranget Fixed in Version => 3.11+dev
2008-03-07 16:29 maranget Resolution open => fixed
2008-03-07 16:29 maranget Note Added: 0004471
2008-03-07 16:30 maranget Note Edited: 0004468
2010-04-29 14:25 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker