Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006812OCamltypingpublic2015-03-12 22:372017-09-24 17:33
Reportersliquister 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.02.1 
Target VersionFixed in Version4.02.2+dev / +rc1 
Summary0006812: Combination of -short-paths and -no-alias-deps can create inconsistent assumptions
DescriptionWhen using -no-alias-deps in combination with a build setup where we have one module in a library that both aliases all the other modules _and_ is used by all modules (see attached script), on type errors and with -short-paths, the compiler may start forcing the environment and load cmis for modules that aren't compiled yet (which is just a warning) or are compiled by not up to date (because they depend on the module being currently compiled for instance) which causes inconsistent assumptions.

I am not sure what the compiler should do. Obviously, not forcing aliases would the problem, but I don't know what the impact is on short-paths.

Also, in case we can kill two birds with one stone, I'll mention that the compiler prefers Lib__A.t in type errors over Lib.A.t which I suppose is expected but still a bit sad.
Steps To ReproduceI attached the script inconsistent_assumptions:

$ /tmp/inconsistent_assumptions
File "b.ml", line 1, characters 14-15:
Error: This expression has type int but an expression was expected of type
         Lib.A.t = float
$ /tmp/inconsistent_assumptions -short-paths
File "b.ml", line 1:
Error: The files lib__A.cmi and lib__B.cmi make inconsistent assumptions
       over interface Lib__A
Additional InformationStack trace of the compiler if it helps (that's the trace for my initial problem, not the small reproduction in the script but it should be the same):

Breakpoint 1, 0x00000000005028d0 in camlEnv__check_consistency_1494 ()
(gdb) bt
#0 0x00000000005028d0 in camlEnv__check_consistency_1494 ()
#1 0x0000000000502d63 in camlEnv__find_pers_struct_inner_3114 ()
#2 0x000000000050335b in camlEnv__find_module_1584 ()
0000003 0x0000000000506260 in camlEnv__scrape_alias_2047 ()
0000004 0x0000000000507c67 in camlEnv__components_of_module_maker_2158 ()
0000005 0x000000000050205c in camlEnv__force_1252 ()
0000006 0x00000000005000bb in camlEnv__iter_components_1902 ()
0000007 0x00000000004a56a1 in camlTbl__iter_1096 ()
0000008 0x00000000004a568b in camlTbl__iter_1096 ()
0000009 0x0000000000617d23 in camlHashtbl__do_bucket_1138 () at hashtbl.ml:188
0000010 0x00000000006190d0 in camlHashtbl__iter_1135 () at hashtbl.ml:191
0000011 0x0000000000505b01 in camlEnv__iter_env_1895 ()
0000012 0x0000000000531e3a in camlPrinttyp__fun_3002 ()
0000013 0x00000000005feb39 in camlCamlinternalLazy__force_lazy_block_1010 () at camlinternalLazy.ml:25
0000014 0x0000000000535870 in camlPrinttyp__best_type_path_1562 ()
0000015 0x000000000053b0c3 in camlPrinttyp__type_same_name_2273 ()
0000016 0x000000000053b133 in camlPrinttyp__trace_same_names_2278 ()
0000017 0x000000000053b191 in camlPrinttyp__unification_error_2284 ()
0000018 0x00000000004a3114 in camlMisc__try_finally_1011 ()
0000019 0x00000000004a3114 in camlMisc__try_finally_1011 ()
0000020 0x00000000004ab33c in camlLocation__error_of_printer_1172 ()
0000021 0x00000000005819af in camlTypecore__fun_7581 ()
0000022 0x00000000004a9d92 in camlLocation__loop_1153 ()
0000023 0x00000000004ab54a in camlLocation__report_exception_rec_1184 ()
0000024 0x000000000044adb5 in camlOptmain__main_1474 ()
0000025 0x000000000044c31f in camlOptmain__entry ()
0000026 0x0000000000446979 in caml_program ()
#27 0x0000000000636de6 in caml_start_program ()
0000028 0x00000000006386d5 in __libc_csu_init ()
0000029 0x0000003c2dc1ed5d in __libc_start_main () from /lib64/libc.so.6
#30 0x0000000000446059 in _start ()
TagsNo tags attached.
Attached Files? file icon inconsistent_assumptions [^] (521 bytes) 2015-03-12 22:37 [Show Content]
? file icon inconsistent_assumptions2 [^] (541 bytes) 2015-03-13 04:49 [Show Content]

- Relationships
related to 0007134assignedgarrigue compiler forcing aliases it shouldn't while reporting type errors 

-  Notes
(0013483)
garrigue (manager)
2015-03-13 04:54

Fixed in 4.02 and trunk at revisions 15916 and 15917.
Note that we do not want to disable visiting of all aliases, but just of aliases of persistent modules, which is a bit more complex.

The test case didn't repeat on the 4.02 branch, as we have switched to incremental computation of the environment. I have add a new test case, which forces the evaluation.
Should eventually add it to the test suite...
(0013484)
sliquister (reporter)
2015-03-13 05:23

Great, thank you! Didn't expect you'd be this quick to fix the problem.

- Issue History
Date Modified Username Field Change
2015-03-12 22:37 sliquister New Issue
2015-03-12 22:37 sliquister File Added: inconsistent_assumptions
2015-03-13 04:49 garrigue File Added: inconsistent_assumptions2
2015-03-13 04:54 garrigue Note Added: 0013483
2015-03-13 04:54 garrigue Status new => resolved
2015-03-13 04:54 garrigue Fixed in Version => 4.02.2+dev / +rc1
2015-03-13 04:54 garrigue Resolution open => fixed
2015-03-13 04:54 garrigue Assigned To => garrigue
2015-03-13 05:23 sliquister Note Added: 0013484
2016-08-23 22:40 garrigue Relationship added related to 0007134
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-09-24 17:33 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker