View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000131 | mercury | Bug | public | 2010-01-28 16:16 | 2010-01-28 16:16 | ||||||||
Reporter | pbone | ||||||||||||
Assigned To | |||||||||||||
Priority | low | Severity | minor | Reproducibility | sometimes | ||||||||
Status | new | Resolution | open | ||||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0000131: Compilation fails when the same variable is used in two trace goals but not outside the trace goals. | ||||||||||||
Description | The following code fails to compile trace [compile_time(flag("debug-dep-par-conj")), io(!IO)] ( OutInfo = init_hlds_out_info(Globals), proc_info_get_varset(!.ProcInfo, VarSet), format("Pred/Proc: %s/%s before dep-par-conj:\n", [s(string(PredId)), s(string(ProcId))], !IO), write_goal(OutInfo, !.Goal, !.ModuleInfo, VarSet, yes, 0, "", !IO), nl(!IO) ), !:SyncInfo = sync_info(!.ModuleInfo, IgnoreVars, AllowSomePathsOnly, !.VarSet, !.VarTypes, proc(PredId, ProcId)), sync_dep_par_conjs_in_goal(!Goal, InstMap0, _, !SyncInfo), !.SyncInfo = sync_info(_, _, _, !:VarSet, !:VarTypes, _), % XXX RTTI varmaps may need to be updated trace [compile_time(flag("debug-dep-par-conj")), io(!IO)] ( OutInfo = init_hlds_out_info(Globals), proc_info_get_varset(!.ProcInfo, VarSet), format("Pred/Proc: %s/%s after dep-par-conj:\n", [s(string(PredId)), s(string(ProcId))], !IO), write_goal(OutInfo, !.Goal, !.ModuleInfo, VarSet, yes, 0, "", !IO), nl(!IO) ), With a confusing error message because the compiler doesn't understand that VarSet in each trace goal is local to that trace goal only. The compiler complains about a variable introduced in the state variable notation of !IO - which is incorrect. The following code works as VarSet is produced outside of both trace goals. OutInfo = init_hlds_out_info(Globals), proc_info_get_varset(!.ProcInfo, VarSet), trace [compile_time(flag("debug-dep-par-conj")), io(!IO)] ( format("Pred/Proc: %s/%s before dep-par-conj:\n", [s(string(PredId)), s(string(ProcId))], !IO), write_goal(OutInfo, !.Goal, !.ModuleInfo, VarSet, yes, 0, "", !IO), nl(!IO) ), !:SyncInfo = sync_info(!.ModuleInfo, IgnoreVars, AllowSomePathsOnly, !.VarSet, !.VarTypes, proc(PredId, ProcId)), sync_dep_par_conjs_in_goal(!Goal, InstMap0, _, !SyncInfo), !.SyncInfo = sync_info(_, _, _, !:VarSet, !:VarTypes, _), % XXX RTTI varmaps may need to be updated trace [compile_time(flag("debug-dep-par-conj")), io(!IO)] ( format("Pred/Proc: %s/%s after dep-par-conj:\n", [s(string(PredId)), s(string(ProcId))], !IO), write_goal(OutInfo, !.Goal, !.ModuleInfo, VarSet, yes, 0, "", !IO), nl(!IO) ), | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2010-01-28 16:16 | pbone | New Issue |