[m-rev.] diff: fix bug 150
Zoltan Somogyi
zs at csse.unimelb.edu.au
Wed Sep 15 14:32:54 AEST 2010
Fix Mantis bug #150.
The bug was that compiler error messages about determinism errors could refer
to a function's determinism declaration even if the function had NO
determinism declaration, and the compiler took its determinism to be
IMPLICITLY declared to be det.
compiler/hlds_pred.m:
Add a field to the proc_info that records whether the determinism
declaration (if any) was explicit or implicit.
Improve the style of the proc_info_set_* predicates' clauses.
compiler/accumulator.m:
compiler/add_pred.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/lambda.m:
compiler/make_hlds.m:
compiler/stm_expand.m:
compiler/table_gen.m:
compiler/unify_proc.m:
Set this field when creating new procedures.
compiler/det_report.m:
Use this field to match the wording of the error message to the given
circumstances.
tests/invalid/bug150.m:
Add the regression test for this bug.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the test case.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.79
diff -u -b -r1.79 accumulator.m
--- compiler/accumulator.m 23 Aug 2010 07:38:27 -0000 1.79
+++ compiler/accumulator.m 14 Sep 2010 14:13:19 -0000
@@ -1476,8 +1476,8 @@
list.map(map.lookup(VarTypes), Accs, AccTypes),
proc_info_create(Context, VarSet, VarTypes, HeadVars, InstVarSet,
- HeadModes, Detism, Goal, RttiVarMaps, IsAddressTaken, VarNameRemap,
- AccProcInfo).
+ HeadModes, detism_decl_none, Detism, Goal, RttiVarMaps,
+ IsAddressTaken, VarNameRemap, AccProcInfo).
%-----------------------------------------------------------------------------%
Index: compiler/add_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
retrieving revision 1.39
diff -u -b -r1.39 add_pred.m
--- compiler/add_pred.m 19 Aug 2009 07:44:52 -0000 1.39
+++ compiler/add_pred.m 14 Sep 2010 14:26:50 -0000
@@ -41,8 +41,8 @@
:- pred do_add_new_proc(inst_varset::in, arity::in, list(mer_mode)::in,
maybe(list(mer_mode))::in, maybe(list(is_live))::in,
- maybe(determinism)::in, prog_context::in, is_address_taken::in,
- pred_info::in, pred_info::out, proc_id::out) is det.
+ detism_decl::in, maybe(determinism)::in, prog_context::in,
+ is_address_taken::in, pred_info::in, pred_info::out, proc_id::out) is det.
% Add a mode declaration for a predicate.
%
@@ -378,14 +378,15 @@
%-----------------------------------------------------------------------------%
do_add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
- MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
- ModeId) :-
+ MaybeArgLives, DetismDecl, MaybeDet, Context, IsAddressTaken,
+ PredInfo0, PredInfo, ModeId) :-
pred_info_get_procedures(PredInfo0, Procs0),
pred_info_get_arg_types(PredInfo0, ArgTypes),
pred_info_get_var_name_remap(PredInfo0, VarNameRemap),
next_mode_id(Procs0, ModeId),
proc_info_init(Context, Arity, ArgTypes, MaybeDeclaredArgModes, ArgModes,
- MaybeArgLives, MaybeDet, IsAddressTaken, VarNameRemap, NewProc0),
+ MaybeArgLives, DetismDecl, MaybeDet, IsAddressTaken, VarNameRemap,
+ NewProc0),
proc_info_set_inst_varset(InstVarSet, NewProc0, NewProc),
map.det_insert(Procs0, ModeId, NewProc, Procs),
pred_info_set_procedures(Procs, PredInfo0, PredInfo).
@@ -438,6 +439,7 @@
% Check that the determinism was specified.
(
MaybeDet = no,
+ DetismDecl = detism_decl_none,
pred_info_get_import_status(!.PredInfo, ImportStatus),
PredOrFunc = pred_info_is_pred_or_func(!.PredInfo),
PredModule = pred_info_module(!.PredInfo),
@@ -461,12 +463,14 @@
)
)
;
- MaybeDet = yes(_)
+ MaybeDet = yes(_),
+ DetismDecl = detism_decl_explicit
),
% Add the mode declaration to the pred_info for this procedure.
ArgLives = no,
do_add_new_proc(InstVarSet, Arity, Modes, yes(Modes), ArgLives,
- MaybeDet, MContext, address_is_not_taken, !PredInfo, ProcId).
+ DetismDecl, MaybeDet, MContext, address_is_not_taken,
+ !PredInfo, ProcId).
preds_add_implicit_report_error(ModuleName, PredOrFunc, PredName, Arity,
Status, IsClassMethod, Context, Origin, Description, PredId,
Index: compiler/add_special_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_special_pred.m,v
retrieving revision 1.28
diff -u -b -r1.28 add_special_pred.m
--- compiler/add_special_pred.m 30 Jul 2010 05:16:07 -0000 1.28
+++ compiler/add_special_pred.m 14 Sep 2010 14:25:25 -0000
@@ -391,7 +391,7 @@
map.init(ConstraintMap),
init_markers(Markers),
% XXX If/when we have "comparable" or "unifiable" typeclasses,
- % XXX this context might not be empty
+ % this context might not be empty.
ClassContext = constraints([], []),
ExistQVars = [],
map.init(VarNameRemap),
@@ -401,10 +401,10 @@
PredInfo0),
ArgLives = no,
varset.init(InstVarSet),
- % Should not be any inst vars here so it's ok to use a
- % fresh inst_varset.
+ % Should not be any inst vars here so it's ok to use a fresh inst_varset.
do_add_new_proc(InstVarSet, Arity, ArgModes, yes(ArgModes), ArgLives,
- yes(Det), Context, address_is_not_taken, PredInfo0, PredInfo, _),
+ detism_decl_implicit, yes(Det), Context, address_is_not_taken,
+ PredInfo0, PredInfo, _ProcId),
module_info_get_predicate_table(!.ModuleInfo, PredicateTable0),
predicate_table_insert(PredInfo, PredId, PredicateTable0, PredicateTable),
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.128
diff -u -b -r1.128 check_typeclass.m
--- compiler/check_typeclass.m 30 Jul 2010 05:16:08 -0000 1.128
+++ compiler/check_typeclass.m 14 Sep 2010 14:29:06 -0000
@@ -724,7 +724,7 @@
OldPredInfo::in, NewPredInfo::out) is det :-
ModeAndDet = modes_and_detism(Modes, InstVarSet, MaybeDet),
add_new_proc(InstVarSet, PredArity, Modes, yes(Modes), no,
- MaybeDet, Context, address_is_taken,
+ detism_decl_implicit, MaybeDet, Context, address_is_taken,
OldPredInfo, NewPredInfo, NewProcId)
),
list.map_foldl(AddProc, ArgModes, InstanceProcIds, PredInfo1, PredInfo),
Index: compiler/clause_to_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.84
diff -u -b -r1.84 clause_to_proc.m
--- compiler/clause_to_proc.m 30 Jul 2010 05:16:08 -0000 1.84
+++ compiler/clause_to_proc.m 14 Sep 2010 14:29:36 -0000
@@ -128,8 +128,8 @@
MaybePredArgLives = no,
varset.init(InstVarSet),
% No inst_vars in default func mode.
- add_new_proc(InstVarSet, PredArity, PredArgModes,
- yes(PredArgModes), MaybePredArgLives, yes(Determinism),
+ add_new_proc(InstVarSet, PredArity, PredArgModes, yes(PredArgModes),
+ MaybePredArgLives, detism_decl_implicit, yes(Determinism),
Context, address_is_not_taken, PredInfo0, PredInfo, ProcId),
MaybeProcId = yes(ProcId)
;
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.149
diff -u -b -r1.149 det_report.m
--- compiler/det_report.m 4 Nov 2009 03:44:46 -0000 1.149
+++ compiler/det_report.m 15 Sep 2010 04:30:25 -0000
@@ -239,8 +239,9 @@
pred_info_get_import_status(PredInfo0, ImportStatus),
status_defined_in_this_module(ImportStatus) = yes
->
- Message = "warning: determinism declaration " ++
- "could be tighter.\n",
+ proc_info_get_detism_decl(ProcInfo0, DetismDecl),
+ Message = "warning: " ++ detism_decl_name(DetismDecl) ++
+ " could be tighter.\n",
report_determinism_problem(PredId, ProcId, !.ModuleInfo,
Message, DeclaredDetism, InferredDetism, ReportMsgs),
ReportSpec = error_spec(severity_warning, phase_detism_check,
@@ -251,7 +252,9 @@
)
;
Cmp = tighter,
- Message = "error: determinism declaration not satisfied.\n",
+ proc_info_get_detism_decl(ProcInfo0, DetismDecl),
+ Message = "error: " ++ detism_decl_name(DetismDecl) ++
+ " not satisfied.\n",
report_determinism_problem(PredId, ProcId, !.ModuleInfo, Message,
DeclaredDetism, InferredDetism, ReportMsgs),
proc_info_get_goal(ProcInfo0, Goal),
@@ -300,6 +303,24 @@
!:Specs = [ValidSpec | !.Specs]
).
+:- func detism_decl_name(detism_decl) = string.
+
+detism_decl_name(DetismDecl) = Name :-
+ (
+ DetismDecl = detism_decl_explicit,
+ Name = "determinism declaration"
+ ;
+ DetismDecl = detism_decl_implicit,
+ Name = "implicit determinism declaration"
+ ;
+ DetismDecl = detism_decl_none,
+ Name = "nonexistent determinism declaration"
+ % This shouldn't happen, but if it does, it is better to get an
+ % error message that puts you on the right track than to get
+ % a compiler abort.
+ % unexpected(this_file, "detism_decl_name: detism_decl_none")
+ ).
+
:- pred get_valid_dets(eval_method::in, determinism::out) is nondet.
get_valid_dets(EvalMethod, Detism) :-
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.260
diff -u -b -r1.260 hlds_pred.m
--- compiler/hlds_pred.m 4 Jul 2010 10:24:08 -0000 1.260
+++ compiler/hlds_pred.m 14 Sep 2010 14:00:17 -0000
@@ -1200,8 +1200,8 @@
MaybeDeclaredDetism = no,
proc_info_create_with_declared_detism(Context, VarSet, VarTypes, ArgVars,
- InstVarSet, ArgModes, MaybeDeclaredDetism, Detism, Goal0,
- RttiVarMaps, IsAddressTaken, VarNameRemap, ProcInfo0),
+ InstVarSet, ArgModes, detism_decl_none, MaybeDeclaredDetism,
+ Detism, Goal0, RttiVarMaps, IsAddressTaken, VarNameRemap, ProcInfo0),
proc_info_set_maybe_termination_info(TermInfo, ProcInfo0, ProcInfo),
set.init(Assertions),
@@ -1905,15 +1905,21 @@
map(prog_var, prog_vars)
).
+:- type detism_decl
+ ---> detism_decl_explicit
+ ; detism_decl_implicit
+ ; detism_decl_none.
+ % The determinism of the procedure is not declared.
+
:- pred proc_info_init(prog_context::in, arity::in, list(mer_type)::in,
maybe(list(mer_mode))::in, list(mer_mode)::in, maybe(list(is_live))::in,
- maybe(determinism)::in, is_address_taken::in, map(prog_var, string)::in,
- proc_info::out) is det.
+ detism_decl::in, maybe(determinism)::in, is_address_taken::in,
+ map(prog_var, string)::in, proc_info::out) is det.
:- pred proc_info_create(prog_context::in,
prog_varset::in, vartypes::in, list(prog_var)::in,
inst_varset::in, list(mer_mode)::in,
- determinism::in, hlds_goal::in,
+ detism_decl::in, determinism::in, hlds_goal::in,
rtti_varmaps::in, is_address_taken::in, map(prog_var, string)::in,
proc_info::out) is det.
@@ -1941,6 +1947,7 @@
maybe(determinism)::out) is det.
:- pred proc_info_get_inferred_determinism(proc_info::in, determinism::out)
is det.
+:- pred proc_info_get_detism_decl(proc_info::in, detism_decl::out) is det.
:- pred proc_info_get_goal(proc_info::in, hlds_goal::out) is det.
:- pred proc_info_get_can_process(proc_info::in, bool::out) is det.
:- pred proc_info_get_rtti_varmaps(proc_info::in, rtti_varmaps::out) is det.
@@ -1993,6 +2000,8 @@
proc_info::in, proc_info::out) is det.
:- pred proc_info_set_inferred_determinism(determinism::in,
proc_info::in, proc_info::out) is det.
+:- pred proc_info_set_detism_decl(detism_decl::in,
+ proc_info::in, proc_info::out) is det.
:- pred proc_info_set_goal(hlds_goal::in,
proc_info::in, proc_info::out) is det.
:- pred proc_info_set_can_process(bool::in,
@@ -2085,6 +2094,7 @@
proc_info::in, proc_info::out) is det.
% See also proc_info_interface_code_model in code_model.m.
+ %
:- pred proc_info_interface_determinism(proc_info::in, determinism::out)
is det.
@@ -2255,6 +2265,10 @@
:- type proc_sub_info
---> proc_sub_info(
+ % Was the determinism declaration explicit, or was it implicit,
+ % as for functions?
+ detism_decl :: detism_decl,
+
% Information about the relative sizes of the input and output
% args of the procedure. Set by termination analysis.
maybe_arg_sizes :: maybe(arg_size_info),
@@ -2467,7 +2481,7 @@
).
proc_info_init(MContext, Arity, Types, DeclaredModes, Modes, MaybeArgLives,
- MaybeDet, IsAddressTaken, VarNameRemap, ProcInfo) :-
+ DetismDecl, MaybeDet, IsAddressTaken, VarNameRemap, ProcInfo) :-
% Some parts of the procedure aren't known yet. We initialize them
% to any old garbage which we will later throw away.
@@ -2490,8 +2504,8 @@
Term2Info = term_constr_main.term2_info_init,
SharingInfo = structure_sharing_info_init,
ReuseInfo = structure_reuse_info_init,
- ProcSubInfo = proc_sub_info(no, no, Term2Info, IsAddressTaken, StackSlots,
- ArgInfo, InitialLiveness, no, no, no, no_tail_call_events,
+ ProcSubInfo = proc_sub_info(DetismDecl, no, no, Term2Info, IsAddressTaken,
+ StackSlots, ArgInfo, InitialLiveness, no, no, no, no_tail_call_events,
no, no, no, no, no, no, VarNameRemap, SharingInfo, ReuseInfo),
ProcInfo = proc_info(MContext, BodyVarSet, BodyTypes, HeadVars, InstVarSet,
DeclaredModes, Modes, no, MaybeArgLives, MaybeDet, InferredDet,
@@ -2499,21 +2513,22 @@
ProcSubInfo).
proc_info_create(Context, VarSet, VarTypes, HeadVars, InstVarSet, HeadModes,
- Detism, Goal, RttiVarMaps, IsAddressTaken, VarNameRemap, ProcInfo) :-
+ DetismDecl, Detism, Goal, RttiVarMaps, IsAddressTaken, VarNameRemap,
+ ProcInfo) :-
proc_info_create_with_declared_detism(Context, VarSet, VarTypes, HeadVars,
- InstVarSet, HeadModes, yes(Detism), Detism, Goal, RttiVarMaps,
- IsAddressTaken, VarNameRemap, ProcInfo).
+ InstVarSet, HeadModes, DetismDecl, yes(Detism), Detism, Goal,
+ RttiVarMaps, IsAddressTaken, VarNameRemap, ProcInfo).
:- pred proc_info_create_with_declared_detism(prog_context::in,
prog_varset::in, vartypes::in, list(prog_var)::in,
inst_varset::in, list(mer_mode)::in,
- maybe(determinism)::in, determinism::in, hlds_goal::in,
+ detism_decl::in, maybe(determinism)::in, determinism::in, hlds_goal::in,
rtti_varmaps::in, is_address_taken::in, map(prog_var, string)::in,
proc_info::out) is det.
proc_info_create_with_declared_detism(Context, VarSet, VarTypes, HeadVars,
- InstVarSet, HeadModes, MaybeDeclaredDetism, Detism, Goal, RttiVarMaps,
- IsAddressTaken, VarNameRemap, ProcInfo) :-
+ InstVarSet, HeadModes, DetismDecl, MaybeDeclaredDetism, Detism,
+ Goal, RttiVarMaps, IsAddressTaken, VarNameRemap, ProcInfo) :-
map.init(StackSlots),
set.init(Liveness),
MaybeHeadLives = no,
@@ -2521,7 +2536,7 @@
Term2Info = term_constr_main.term2_info_init,
SharingInfo = structure_sharing_info_init,
ReuseInfo = structure_reuse_info_init,
- ProcSubInfo = proc_sub_info(no, no, Term2Info, IsAddressTaken,
+ ProcSubInfo = proc_sub_info(DetismDecl, no, no, Term2Info, IsAddressTaken,
StackSlots, no, Liveness, no, no, no, no_tail_call_events,
no, no, no, no, no, no, VarNameRemap, SharingInfo, ReuseInfo),
ProcInfo = proc_info(Context, VarSet, VarTypes, HeadVars,
@@ -2546,6 +2561,7 @@
proc_info_get_maybe_arglives(PI, PI ^ head_var_caller_liveness).
proc_info_get_declared_determinism(PI, PI ^ declared_detism).
proc_info_get_inferred_determinism(PI, PI ^ inferred_detism).
+proc_info_get_detism_decl(PI, PI ^ proc_sub_info ^ detism_decl).
proc_info_get_goal(PI, PI ^ body).
proc_info_get_can_process(PI, PI ^ can_process).
proc_info_get_rtti_varmaps(PI, PI ^ proc_rtti_varmaps).
@@ -2574,51 +2590,66 @@
proc_info_get_maybe_untuple_info(PI, PI ^ proc_sub_info ^ maybe_untuple_info).
proc_info_get_var_name_remap(PI, PI ^ proc_sub_info ^ proc_var_name_remap).
-proc_info_set_varset(VS, PI, PI ^ prog_varset := VS).
-proc_info_set_vartypes(VT, PI, PI ^ var_types := VT).
-proc_info_set_headvars(HV, PI, PI ^ head_vars := HV).
-proc_info_set_inst_varset(IV, PI, PI ^ inst_varset := IV).
-proc_info_set_maybe_declared_argmodes(AM, PI,
- PI ^ maybe_declared_head_modes := AM).
-proc_info_set_argmodes(AM, PI, PI ^ actual_head_modes := AM).
-proc_info_set_maybe_arglives(CL, PI, PI ^ head_var_caller_liveness := CL).
-proc_info_set_inferred_determinism(ID, PI, PI ^ inferred_detism := ID).
-proc_info_set_goal(G, PI, PI ^ body := G).
-proc_info_set_can_process(CP, PI, PI ^ can_process := CP).
-proc_info_set_rtti_varmaps(RI, PI, PI ^ proc_rtti_varmaps := RI).
-proc_info_set_eval_method(EM, PI, PI ^ eval_method := EM).
-proc_info_set_maybe_arg_size_info(MAS, PI,
- PI ^ proc_sub_info ^ maybe_arg_sizes := MAS).
-proc_info_set_maybe_termination_info(MT, PI,
- PI ^ proc_sub_info ^ maybe_termination := MT).
-proc_info_set_address_taken(AT, PI,
- PI ^ proc_sub_info ^ is_address_taken := AT).
-proc_info_set_stack_slots(SS, PI, PI ^ proc_sub_info ^ stack_slots := SS).
-proc_info_set_arg_info(AP, PI, PI ^ proc_sub_info ^ arg_pass_info := yes(AP)).
-proc_info_set_liveness_info(IL, PI,
- PI ^ proc_sub_info ^ initial_liveness := IL).
-proc_info_set_need_maxfr_slot(NMS, PI,
- PI ^ proc_sub_info ^ need_maxfr_slot := NMS).
-proc_info_set_has_user_event(HUE, PI,
- PI ^ proc_sub_info ^ proc_has_user_event := HUE).
-proc_info_set_has_parallel_conj(HPC, PI,
- PI ^ proc_sub_info ^ proc_has_parallel_conj := HPC).
-proc_info_set_has_tail_call_events(HPC, PI,
- PI ^ proc_sub_info ^ proc_has_tail_call_events := HPC).
-proc_info_set_call_table_tip(CTT, PI,
- PI ^ proc_sub_info ^ call_table_tip := CTT).
-proc_info_set_maybe_proc_table_io_info(MTI, PI,
- PI ^ proc_sub_info ^ maybe_table_io_info := MTI).
-proc_info_set_table_attributes(TA, PI,
- PI ^ proc_sub_info ^ table_attributes := TA).
-proc_info_set_maybe_special_return(MSR, PI,
- PI ^ proc_sub_info ^ maybe_special_return := MSR).
-proc_info_set_maybe_deep_profile_info(DPI, PI,
- PI ^ proc_sub_info ^ maybe_deep_profile_proc_info := DPI).
-proc_info_set_maybe_untuple_info(MUI, PI,
- PI ^ proc_sub_info ^ maybe_untuple_info := MUI).
-proc_info_set_var_name_remap(VNR, PI,
- PI ^ proc_sub_info ^ proc_var_name_remap := VNR).
+proc_info_set_varset(VS, !PI) :-
+ !PI ^ prog_varset := VS.
+proc_info_set_vartypes(VT, !PI) :-
+ !PI ^ var_types := VT.
+proc_info_set_headvars(HV, !PI) :-
+ !PI ^ head_vars := HV.
+proc_info_set_inst_varset(IV, !PI) :-
+ !PI ^ inst_varset := IV.
+proc_info_set_maybe_declared_argmodes(AM, !PI) :-
+ !PI ^ maybe_declared_head_modes := AM.
+proc_info_set_argmodes(AM, !PI) :-
+ !PI ^ actual_head_modes := AM.
+proc_info_set_maybe_arglives(CL, !PI) :-
+ !PI ^ head_var_caller_liveness := CL.
+proc_info_set_inferred_determinism(ID, !PI) :-
+ !PI ^ inferred_detism := ID.
+proc_info_set_detism_decl(ID, !PI) :-
+ !PI ^ proc_sub_info ^ detism_decl := ID.
+proc_info_set_goal(G, !PI) :-
+ !PI ^ body := G.
+proc_info_set_can_process(CP, !PI) :-
+ !PI ^ can_process := CP.
+proc_info_set_rtti_varmaps(RI, !PI) :-
+ !PI ^ proc_rtti_varmaps := RI.
+proc_info_set_eval_method(EM, !PI) :-
+ !PI ^ eval_method := EM.
+proc_info_set_maybe_arg_size_info(MAS, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_arg_sizes := MAS.
+proc_info_set_maybe_termination_info(MT, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_termination := MT.
+proc_info_set_address_taken(AT, !PI) :-
+ !PI ^ proc_sub_info ^ is_address_taken := AT.
+proc_info_set_stack_slots(SS, !PI) :-
+ !PI ^ proc_sub_info ^ stack_slots := SS.
+proc_info_set_arg_info(AP, !PI) :-
+ !PI ^ proc_sub_info ^ arg_pass_info := yes(AP).
+proc_info_set_liveness_info(IL, !PI) :-
+ !PI ^ proc_sub_info ^ initial_liveness := IL.
+proc_info_set_need_maxfr_slot(NMS, !PI) :-
+ !PI ^ proc_sub_info ^ need_maxfr_slot := NMS.
+proc_info_set_has_user_event(HUE, !PI) :-
+ !PI ^ proc_sub_info ^ proc_has_user_event := HUE.
+proc_info_set_has_parallel_conj(HPC, !PI) :-
+ !PI ^ proc_sub_info ^ proc_has_parallel_conj := HPC.
+proc_info_set_has_tail_call_events(HPC, !PI) :-
+ !PI ^ proc_sub_info ^ proc_has_tail_call_events := HPC.
+proc_info_set_call_table_tip(CTT, !PI) :-
+ !PI ^ proc_sub_info ^ call_table_tip := CTT.
+proc_info_set_maybe_proc_table_io_info(MTI, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_table_io_info := MTI.
+proc_info_set_table_attributes(TA, !PI) :-
+ !PI ^ proc_sub_info ^ table_attributes := TA.
+proc_info_set_maybe_special_return(MSR, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_special_return := MSR.
+proc_info_set_maybe_deep_profile_info(DPI, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_deep_profile_proc_info := DPI.
+proc_info_set_maybe_untuple_info(MUI, !PI) :-
+ !PI ^ proc_sub_info ^ maybe_untuple_info := MUI.
+proc_info_set_var_name_remap(VNR, !PI) :-
+ !PI ^ proc_sub_info ^ proc_var_name_remap := VNR.
proc_info_head_modes_constraint(ProcInfo, HeadModesConstraint) :-
MaybeHeadModesConstraint = ProcInfo ^ maybe_head_modes_constraint,
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.143
diff -u -b -r1.143 lambda.m
--- compiler/lambda.m 30 Jul 2010 05:16:12 -0000 1.143
+++ compiler/lambda.m 14 Sep 2010 14:15:23 -0000
@@ -541,8 +541,9 @@
restrict_var_maps(AllArgVars, LambdaGoal, VarSet, LambdaVarSet,
VarTypes, LambdaVarTypes, RttiVarMaps, LambdaRttiVarMaps),
proc_info_create(LambdaContext, LambdaVarSet, LambdaVarTypes,
- AllArgVars, InstVarSet, AllArgModes, Detism, LambdaGoal,
- LambdaRttiVarMaps, address_is_taken, VarNameRemap, ProcInfo0),
+ AllArgVars, InstVarSet, AllArgModes, detism_decl_explicit, Detism,
+ LambdaGoal, LambdaRttiVarMaps, address_is_taken, VarNameRemap,
+ ProcInfo0),
% The debugger ignores unnamed variables.
ensure_all_headvars_are_named(ProcInfo0, ProcInfo1),
@@ -558,7 +559,6 @@
% that we just created.
(
MustRecomputeNonLocals0 = yes,
- % ZZZ
requantify_proc_general(ordinary_nonlocals_maybe_lambda,
ProcInfo2, ProcInfo)
;
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.531
diff -u -b -r1.531 make_hlds.m
--- compiler/make_hlds.m 12 Jan 2010 03:12:36 -0000 1.531
+++ compiler/make_hlds.m 14 Sep 2010 14:25:53 -0000
@@ -63,8 +63,8 @@
:- pred add_new_proc(inst_varset::in, arity::in, list(mer_mode)::in,
maybe(list(mer_mode))::in, maybe(list(is_live))::in,
- maybe(determinism)::in, prog_context::in, is_address_taken::in,
- pred_info::in, pred_info::out, proc_id::out) is det.
+ detism_decl::in, maybe(determinism)::in, prog_context::in,
+ is_address_taken::in, pred_info::in, pred_info::out, proc_id::out) is det.
% add_special_pred_for_real(SpecialPredId, TVarSet, Type, TypeCtor,
% TypeBody, TypeContext, TypeStatus, !ModuleInfo).
@@ -147,11 +147,11 @@
Specs).
add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
- MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
- ModeId) :-
+ MaybeArgLives, DetismDecl, MaybeDet, Context, IsAddressTaken,
+ PredInfo0, PredInfo, ModeId) :-
do_add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
- MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
- ModeId).
+ MaybeArgLives, DetismDecl, MaybeDet, Context, IsAddressTaken,
+ PredInfo0, PredInfo, ModeId).
add_special_pred_for_real(SpecialPredId, TVarSet,
Type0, TypeCtor, TypeBody, Context, Status0, !ModuleInfo) :-
Index: compiler/stm_expand.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stm_expand.m,v
retrieving revision 1.11
diff -u -b -r1.11 stm_expand.m
--- compiler/stm_expand.m 30 Jul 2010 05:16:16 -0000 1.11
+++ compiler/stm_expand.m 14 Sep 2010 14:15:45 -0000
@@ -2421,8 +2421,9 @@
proc_info_get_rtti_varmaps(ProcInfo, ProcRttiVarMaps),
proc_info_get_var_name_remap(ProcInfo, VarNameRemap),
proc_info_create(ProcContext, ProcVarSet, ProcVarTypes, ProcHeadVars,
- ProcInstVarSet, ProcHeadModes, ProcDetism, ProcGoal, ProcRttiVarMaps,
- address_is_not_taken, VarNameRemap, NewProcInfo),
+ ProcInstVarSet, ProcHeadModes, detism_decl_none, ProcDetism,
+ ProcGoal, ProcRttiVarMaps, address_is_not_taken, VarNameRemap,
+ NewProcInfo),
ModuleName = pred_info_module(PredInfo),
OrigPredName = pred_info_name(PredInfo),
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.154
diff -u -b -r1.154 table_gen.m
--- compiler/table_gen.m 30 Jul 2010 05:16:17 -0000 1.154
+++ compiler/table_gen.m 14 Sep 2010 14:16:03 -0000
@@ -1914,8 +1914,8 @@
proc_info_get_rtti_varmaps(ProcInfo, ProcRttiVarMaps),
proc_info_get_var_name_remap(ProcInfo, VarNameRemap),
proc_info_create(ProcContext, ProcVarSet, ProcVarTypes, ProcHeadVars,
- ProcInstVarSet, ProcHeadModes, ProcDetism, ProcGoal, ProcRttiVarMaps,
- address_is_not_taken, VarNameRemap, NewProcInfo),
+ ProcInstVarSet, ProcHeadModes, detism_decl_none, ProcDetism, ProcGoal,
+ ProcRttiVarMaps, address_is_not_taken, VarNameRemap, NewProcInfo),
ModuleName = pred_info_module(PredInfo),
OrigPredName = pred_info_name(PredInfo),
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.212
diff -u -b -r1.212 unify_proc.m
--- compiler/unify_proc.m 30 Jul 2010 05:16:19 -0000 1.212
+++ compiler/unify_proc.m 14 Sep 2010 14:29:49 -0000
@@ -331,7 +331,8 @@
list.length(ArgModes, Arity),
DeclaredArgModes = no,
add_new_proc(InstVarSet, Arity, ArgModes, DeclaredArgModes, ArgLives,
- MaybeDet, Context, address_is_not_taken, !PredInfo, ProcId),
+ detism_decl_implicit, MaybeDet, Context, address_is_not_taken,
+ !PredInfo, ProcId),
% Copy the clauses for the procedure from the pred_info
% to the proc_info, and mark the procedure as one that
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.241
diff -u -b -r1.241 Mmakefile
--- tests/invalid/Mmakefile 10 Sep 2010 05:15:03 -0000 1.241
+++ tests/invalid/Mmakefile 15 Sep 2010 02:38:07 -0000
@@ -48,6 +48,7 @@
bind_in_negated \
bind_var_errors \
bug113 \
+ bug150 \
bug83 \
builtin_int \
builtin_proc \
Index: tests/invalid/bug150.err_exp
===================================================================
RCS file: tests/invalid/bug150.err_exp
diff -N tests/invalid/bug150.err_exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/bug150.err_exp 15 Sep 2010 02:33:35 -0000
@@ -0,0 +1,5 @@
+bug150.m:012: In `car'(in) = out:
+bug150.m:012: error: implicit determinism declaration not satisfied.
+bug150.m:012: Declared `det', inferred `semidet'.
+bug150.m:016: In argument 1 of clause head:
+bug150.m:016: unification of `HeadVar__1' and `list.[H | _T]' can fail.
Index: tests/invalid/bug150.m
===================================================================
RCS file: tests/invalid/bug150.m
diff -N tests/invalid/bug150.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/bug150.m 15 Sep 2010 02:33:06 -0000
@@ -0,0 +1,16 @@
+% vim: ts=4 sw=4 et ft=mercury
+%
+% This is a regression test for Mantis bug #150. The problem was that the
+% message about the determinism error for car referred to car's determinism
+% declaration, even though the function doesn't have one.
+
+:- module bug150.
+
+:- interface.
+:- import_module list.
+
+:- func car(list(T)) = T.
+
+:- implementation.
+
+car([H | _T]) = H.
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list