Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007682OCamlconfigure and build/installpublic2017-11-29 00:212017-12-05 18:37
Reporterdisteph 
Assigned Tofrisch 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformLinuxOSOS Version
Product Version4.06.0 
Target VersionFixed in Version4.07.0+dev 
Summary0007682: [@@unboxed] for records with 1 polymorphic field
DescriptionThe following three lines lead to a compile-time crash

type f = {field: 'a. 'a list} [@@unboxed]
let g = Array.make 10 { field=[] }
let h = g.(5)

The error is
Fatal error: exception File "typing/typeopt.ml", line 98, characters 6-12: Assertion failed
Steps To Reproduceocamlc bug.ml

where bug is the attached file.
Additional InformationI was surprised by the nature of the error. Merlin didn't complain about typing, and the "exception File "typing/typeopt.ml", line 98, characters 6-12: Assertion failed" is not where I would have expected a problem to arise.

If it is a known limitation of unboxing that doesn't marry well with polymorphism in the field type, I would have expected the error to tell me so, while an "Assertion failed" sounds more like a missed case.

It'd be amazing if it did work by just removing the assertion, though. But life is probably not that beautiful.

Reproducible in 4.05.0 (at least).
TagsNo tags attached.
Attached Files? file icon bug.ml [^] (92 bytes) 2017-11-29 00:21 [Show Content]

- Relationships

-  Notes
(0018708)
disteph (reporter)
2017-11-29 00:24

Also, it's surprising that the first two lines alone compile perfectly well

type f = {field: 'a. 'a list} [@@unboxed]
let g = Array.make 10 { field=[] }

It's really when I access an array cell that the compilation crashes.
(0018709)
frisch (developer)
2017-11-29 09:35

I believe Ctype.get_unboxed_type_representation should traverse Tpoly. Working on a fix.
(0018712)
frisch (developer)
2017-11-29 10:06

https://github.com/ocaml/ocaml/pull/1495 [^]
(0018727)
gasche (developer)
2017-11-30 11:21

The issue was fixed by merging Alain Frisch's patch. Thanks for the testing and report!
(0018732)
disteph (reporter)
2017-12-05 18:37

Thank you both for your very prompt response!

- Issue History
Date Modified Username Field Change
2017-11-29 00:21 disteph New Issue
2017-11-29 00:21 disteph File Added: bug.ml
2017-11-29 00:24 disteph Note Added: 0018708
2017-11-29 09:35 frisch Note Added: 0018709
2017-11-29 10:06 frisch Note Added: 0018712
2017-11-30 11:21 gasche Note Added: 0018727
2017-11-30 11:21 gasche Status new => resolved
2017-11-30 11:21 gasche Fixed in Version => 4.07.0+dev
2017-11-30 11:21 gasche Resolution open => fixed
2017-11-30 11:21 gasche Assigned To => frisch
2017-12-05 18:37 disteph Note Added: 0018732


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker