Mercury Bugs - mercury
View Issue Details
0000297mercuryBugpublic2013-08-29 13:262013-09-04 11:52
Reporterwangp 
Assigned Towangp 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000297: compile-time evaluation of typed_unify changes behaviour
DescriptionThe attached program is broken by the compile-time evaluation of typed_unify when --optimise-constant-propagation is enabled (-O3).
TagsNo tags attached.
Attached Files? t.m (834) 2013-08-29 13:26
https://bugs.mercurylang.org/file_download.php?file_id=179&type=bug

Notes
(0000562)
wangp   
2013-09-03 15:31   
Rather, it has to do the inst of the static type_info when --const-struct is enabled. That --optimise-constant-propagation (and the predicate const_prop.eval_unify) breaks the program seems to be a symptom.

I suspect commit ee63cb8d, specifically these lines in polymorphism.m:

            StructType = type_info_type,
            list.length(ArgTypeInfoConstArgs, NumArgs),
            InstConsId = cell_inst_cons_id(Cell, NumArgs),
            StructInst = bound(shared, inst_test_results_fgtc,
                [bound_functor(InstConsId, StructArgInsts)]),

the NumArgs argument to cell_inst_cons_id.
(0000564)
wangp   
2013-09-04 11:52   
Fixed in 06e175d34d82b7dce3870d89f070c1d58e038d87

Issue History
2013-08-29 13:26wangpNew Issue
2013-08-29 13:26wangpFile Added: t.m
2013-09-03 15:31wangpNote Added: 0000562
2013-09-04 11:52wangpNote Added: 0000564
2013-09-04 11:52wangpStatusnew => resolved
2013-09-04 11:52wangpResolutionopen => fixed
2013-09-04 11:52wangpAssigned To => wangp