Mercury Bugs - mercury
View Issue Details
0000071mercuryBugpublic2008-07-30 17:552021-01-09 15:59
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000071: compiler abort when building programs in debugging grades
DescriptionThe attached program aborts with the following:

Uncaught Mercury exception:
Software Error: map.lookup: key not found
    Key Type: term.var(parse_tree.prog_data.prog_var_type)
    Key Value: var(37)
    Value Type: ll_backend.var_locn.var_state

Compile with: mmc --grade asm_fast.gc.tr.debug -C zinc_fdic_solver.m
TagsNo tags attached.
Attached Files? zinc_fdic_solver.m (3,764) 2008-07-30 17:55
https://bugs.mercurylang.org/file_download.php?file_id=56&type=bug

Notes
(0000109)
zs   
2008-08-01 12:29   
The problem arises from the duplication by switch detection of the deconstruction unification that bind a typeclassinfo. Originally,
that typeclassinfo is var 37. It is duplicated as var 81. The duplication
updates the rtti_var_info but not the type_info varmap or the typeclass_info
varmap, as shown below from this extract from the HLDS dump after switch detection:

% type_info varmap:
% I_1 (number 1) -> typeclass_info(TypeClassInfo_for_int_var_37, 1) (number 37)
% typeclass_info varmap:
% zinc_fdic_solver.int_var(I_1) -> TypeClassInfo_for_int_var_37

% rtti_var_info:
% TypeClassInfo_for_int_var_37 (number 37) -> typeclass_info for zinc_fdic_solver.int_var(I_1)
% TypeClassInfo_for_int_var_81 (number 81) -> typeclass_info for zinc_fdic_solver.int_var(I_1)

The code generator looks at the first two maps when generating layout structures for the debugger.
(0001127)
juliensf   
2021-01-09 15:59   
The abort message is now:

Uncaught Mercury exception:
Software Error: predicate `ll_backend.var_locn.actually_place_var'/6: Unexpected: placing nondummy var which has no state

Issue History
2008-07-30 17:55juliensfNew Issue
2008-07-30 17:55juliensfFile Added: zinc_fdic_solver.m
2008-08-01 12:29zsNote Added: 0000109
2021-01-09 15:59juliensfNote Added: 0001127