Anonymous | Login | Signup for a new account | 2019-02-20 03:12 CET | ![]() |
Main | My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||
0006726 | OCaml | back end (clambda to assembly) | public | 2014-12-18 16:46 | 2016-12-07 11:37 | |||
Reporter | chambart | |||||||
Assigned To | garrigue | |||||||
Priority | normal | Severity | crash | Reproducibility | always | |||
Status | closed | Resolution | fixed | |||||
Platform | OS | OS Version | ||||||
Product Version | 4.03.0+dev / +beta1 | |||||||
Target Version | Fixed in Version | 4.03.0+dev / +beta1 | ||||||
Summary | 0006726: Access to the wrong field of aliased module | |||||||
Description | The problem was introduced by the commit 15405 "Fix PR#6465: allow incremental weakening of module aliases" When compiling the example containing 3 files: extUnixAll.ml, extUnix.ml, test_endian_string.ml ExtUnixAll.ml is external unused : unit -> unit = "caml_blit_string" module BigEndian = struct let get_uint8 str off = 33 end ExtUnix.ml is module All = ExtUnixAll test_endian_string.ml is open ExtUnix.All let test_endian_string x = let module B = BigEndian in B.get_uint8 x 0 let v = test_endian_string 1 The module ExtUnixAll compiles to this lambda code: (seq (seq (let (get_uint8/1009 = (function str/1010 off/1011 33)) (setfield_imm 1 (global ExtUnixAll!) get_uint8/1009)) 0a) (let (BigEndian/1012 = (makeblock 0 (field 1 (global ExtUnixAll!)))) (seq (setfield_imm 0 (global ExtUnixAll!) BigEndian/1012) 0a))) i.e. the module "BigEndian" is at field 0 With the trunk, test_string_endian compiles to: (seq (let (test_endian_string/1201 = (function x/1202 (let (B/1204 = (let (let/1208 =a 0a) (field 1 (global ExtUnixAll!)))) (apply (field 0 B/1204) x/1202 0)))) (setfield_imm 0 (global Test_endian_string!) test_endian_string/1201)) (let (v/1205 = (apply (field 0 (global Test_endian_string!)) 1)) (setfield_imm 1 (global Test_endian_string!) v/1205)) 0a) i.e. it tries to access to the module at field 1 When looking at the typedtree, before 15405: Pexp_letmodule "B/1012" module_expr Pmod_ident "ExtUnix!.All.BigEndian" after 15405: Pexp_letmodule "B/1204" module_expr module_expr Pmod_ident "ExtUnix!.All.BigEndian" i.e. there is an additionnal Tmod_constraint. My conclusion would be that the external in ExtUnixAll is considered as a regular function when coercing hence shifting the field access. | |||||||
Steps To Reproduce | ocamlc -c extUnixAll.ml ocamlc -c extUnix.ml ocamlc -c -no-alias-deps test_endian_string.ml ocamlc -o test.byte extUnixAll.cmo test_endian_string.cmo ./test.byte | |||||||
Tags | No tags attached. | |||||||
Attached Files | ![]() | |||||||
![]() |
|
(0012884) garrigue (manager) 2014-12-19 08:21 |
Fix in trunk at revision 15681. Mtype.strengthen was not computing offsets correctly. Should probably create a central point to solve this offset thing... |
![]() |
|||
Date Modified | Username | Field | Change |
2014-12-18 16:46 | chambart | New Issue | |
2014-12-18 16:46 | chambart | File Added: bug.tar | |
2014-12-19 08:20 | garrigue | Status | new => resolved |
2014-12-19 08:20 | garrigue | Fixed in Version | => 4.03.0+dev / +beta1 |
2014-12-19 08:20 | garrigue | Resolution | open => fixed |
2014-12-19 08:20 | garrigue | Assigned To | => garrigue |
2014-12-19 08:21 | garrigue | Note Added: 0012884 | |
2016-12-07 11:37 | xleroy | Status | resolved => closed |
2017-02-23 16:35 | doligez | Category | OCaml backend (code generation) => Back end (clambda to assembly) |
2017-02-23 16:44 | doligez | Category | Back end (clambda to assembly) => back end (clambda to assembly) |
Copyright © 2000 - 2011 MantisBT Group |