2024-12-03 01:53 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000131mercuryBugpublic2010-01-28 16:16
Reporterpbone 
Assigned To 
PrioritylowSeverityminorReproducibilitysometimes
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000131: 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)
        ),
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2010-01-28 16:16 pbone New Issue
+Issue History