[m-rev.] diff: fix mantis bug 197

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon May 16 15:02:44 AEST 2011


Fix Mantis bug 197.

compiler/add_clause.m:
	If the state variable transformation report an error (as opposed to a
	warning), then act as if we got a syntax error, and ignore the clause
	body.

compiler/state_var.m:
	Return a list of errors as well as warnings.

	Loosen the over-tight sanity check that caused the bug. The sanity
	check insisted that a state variable that is updated in one or more
	arms of a branched control structure (disjunction, switch, or
	if-then-else) could not be readonly. However, if a readonly variable
	DOES happen to be illegally updated in an arm, existing code in the
	state var transformation generates an error message, and then records
	the variable as updated (and hence further updateable) to avoid error
	messages for later updates in the same readonly context. As shown by
	the bug test case, this can lead to violations of the sanity check.

	The alternative approach would be to keep the readonly status of
	the variable after illegal updates. Whether the additional error
	messages generated for any other illegal updates on the same
	computation paths would be helpful or noise is at the moment a
	question of taste and guessing; there is as yet no empirical data
	that would allow a reasoned decision one way or the other.

compiler/superhomogeneous.m:
	Fix style.

tests/invalid/bug197.{m,err_exp}:
	A regression test for the bug.

tests/invalid/Mmakefile:
	Enable the new test.

Zoltan.

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/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.65
diff -u -b -r1.65 add_clause.m
--- compiler/add_clause.m	3 May 2011 04:34:52 -0000	1.65
+++ compiler/add_clause.m	13 May 2011 09:13:50 -0000
@@ -492,19 +492,23 @@
     varset.merge_renaming(VarSet0, CVarSet, VarSet1, Renaming),
     add_clause_transform(Renaming, HeadVars, Args, Body, Context, PredOrFunc,
         Arity, GoalType, Goal0, VarSet1, VarSet,
-        QuantWarnings, StateVarWarnings, !ModuleInfo, !QualInfo, !Specs),
+        QuantWarnings, StateVarWarnings, StateVarErrors,
+        !ModuleInfo, !QualInfo, !Specs),
     qual_info_get_tvarset(!.QualInfo, TVarSet),
     qual_info_get_found_syntax_error(!.QualInfo, FoundError),
     qual_info_set_found_syntax_error(no, !QualInfo),
     (
-        FoundError = yes,
+        ( FoundError = yes
+        ; StateVarErrors = [_ | _]
+        )
+    ->
         % Don't insert clauses containing syntax errors into the clauses_info,
         % because doing that would cause typecheck.m to report spurious type
         % errors. Don't report singleton variable warnings if there were
         % syntax errors.
+        !:Specs = StateVarErrors ++ !.Specs,
         Goal = true_goal
     ;
-        FoundError = no,
         Goal = Goal0,
 
         % If we have foreign clauses, we should only add this clause
@@ -561,13 +565,13 @@
     proc_arg_vector(prog_var)::in, list(prog_term)::in, goal::in,
     prog_context::in, pred_or_func::in, arity::in, goal_type::in,
     hlds_goal::out, prog_varset::in, prog_varset::out,
-    list(quant_warning)::out, list(error_spec)::out,
+    list(quant_warning)::out, list(error_spec)::out, list(error_spec)::out,
     module_info::in, module_info::out, qual_info::in, qual_info::out,
     list(error_spec)::in, list(error_spec)::out) is det.
 
 add_clause_transform(Renaming, HeadVars, Args0, ParseBody, Context, PredOrFunc,
         Arity, GoalType, Goal, !VarSet, QuantWarnings, StateVarWarnings,
-        !ModuleInfo, !QualInfo, !Specs) :-
+        StateVarErrors, !ModuleInfo, !QualInfo, !Specs) :-
     some [!SInfo, !SVarState, !SVarStore] (
         HeadVarList = proc_arg_vector_to_list(HeadVars),
         rename_vars_in_term_list(need_not_rename, Renaming, Args0, Args1),
@@ -632,7 +636,7 @@
         FinalSVarState = !.SVarState,
         svar_finish_clause_body(Context, FinalSVarMap,
             [HeadGoal, BodyGoal], Goal0, InitialSVarState, FinalSVarState,
-            !.SVarStore, StateVarWarnings),
+            !.SVarStore, StateVarWarnings, StateVarErrors),
 
         qual_info_get_var_types(!.QualInfo, VarTypes0),
         % The RTTI varmaps here are just a dummy value, because the real ones
Index: compiler/state_var.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/state_var.m,v
retrieving revision 1.38
diff -u -b -r1.38 state_var.m
--- compiler/state_var.m	5 May 2011 03:58:56 -0000	1.38
+++ compiler/state_var.m	15 May 2011 08:00:31 -0000
@@ -84,7 +84,7 @@
 :- pred svar_finish_clause_body(prog_context::in, map(svar, prog_var)::in,
     list(hlds_goal)::in, hlds_goal::out,
     svar_state::in, svar_state::in, svar_store::in,
-    list(error_spec)::out) is det.
+    list(error_spec)::out, list(error_spec)::out) is det.
 
     % Prepare for processing a lambda expression by processing its head.
     %
@@ -359,7 +359,7 @@
                 store_next_goal_id  ::  counter,
                 store_final_remap   ::  map(goal_id,
                                             assoc_list(prog_var, prog_var)),
-                store_warnings      ::  list(error_spec)
+                store_specs         ::  list(error_spec)
             ).
 
     % Create a new svar_state/store set up to start processing a clause head.
@@ -646,11 +646,12 @@
 %
 
 svar_finish_clause_body(Context, FinalMap, Goals0, Goal,
-        InitialSVarState, FinalSVarState,
-        !.SVarStore, Warnings) :-
+        InitialSVarState, FinalSVarState, !.SVarStore,
+        WarningSpecs, ErrorSpecs) :-
     svar_finish_body(Context, FinalMap, Goals0, Goal1,
         InitialSVarState, FinalSVarState, !SVarStore),
-    !.SVarStore = svar_store(_, DelayedRenamings, Warnings),
+    !.SVarStore = svar_store(_, DelayedRenamings, Specs),
+    list.filter(severity_is_error, Specs, ErrorSpecs, WarningSpecs),
     (
         map.is_empty(FinalMap),
         map.is_empty(DelayedRenamings)
@@ -704,7 +705,7 @@
 
     Goal1 = hlds_goal(GoalExpr1, GoalInfo1),
     GoalId1 = goal_info_get_goal_id(GoalInfo1),
-    !.Store = svar_store(NextGoalId1, DelayedRenamingMap1, Warnings),
+    !.Store = svar_store(NextGoalId1, DelayedRenamingMap1, Specs),
     ( map.search(DelayedRenamingMap1, GoalId1, DelayedRenaming0) ->
         trace [compiletime(flag("state-var-lambda")), io(!IO)] (
             io.write_string("\nfinishing body, ", !IO),
@@ -747,7 +748,7 @@
             Goal = hlds_goal(GoalExpr1, GoalInfo)
         )
     ),
-    !:Store = svar_store(NextGoalId, DelayedRenamingMap, Warnings).
+    !:Store = svar_store(NextGoalId, DelayedRenamingMap, Specs).
 
 :- pred svar_find_final_renames_and_copy_goals(assoc_list(svar, prog_var)::in,
     map(svar, svar_status)::in, map(svar, svar_status)::in,
@@ -928,13 +929,13 @@
             ChangedStatusListAfter),
         StateAfter = svar_state(StatusMapAfter),
 
-        !.Store = svar_store(NextGoalId0, DelayedRenamings0, Warnings0),
+        !.Store = svar_store(NextGoalId0, DelayedRenamings0, Specs0),
         merge_changes_made_by_arms(DisjStates, StatusMapBefore,
             ChangedStatusListAfter, !.VarSet, [], RevDisjs,
             NextGoalId0, NextGoalId, DelayedRenamings0, DelayedRenamings,
-            Warnings0, Warnings),
+            Specs0, Specs),
         list.reverse(RevDisjs, Disjs),
-        !:Store = svar_store(NextGoalId, DelayedRenamings, Warnings)
+        !:Store = svar_store(NextGoalId, DelayedRenamings, Specs)
     ).
 
 :- pred get_disjuncts_with_empty_states(list(hlds_goal_svar_state)::in,
@@ -1002,10 +1003,10 @@
     list(error_spec)::in, list(error_spec)::out) is det.
 
 merge_changes_made_by_arms([], _StatusMapBefore, _ChangedStatusListAfter,
-        _VarSet, !RevArms, !NextGoalId, !DelayedRenamings, !Warnings).
+        _VarSet, !RevArms, !NextGoalId, !DelayedRenamings, !Specs).
 merge_changes_made_by_arms([ArmState | ArmStates],
         StatusMapBefore, ChangedStatusListAfter, VarSet, !RevArms,
-        !NextGoalId, !DelayedRenamings, !Warnings) :-
+        !NextGoalId, !DelayedRenamings, !Specs) :-
     ArmState = hlds_goal_svar_state(Arm0, StateAfterArm),
     StatusMapAfterArm = StateAfterArm ^ state_status_map,
     counter.allocate(ArmIdNum, !NextGoalId),
@@ -1031,15 +1032,14 @@
         % a variable, but we record a warning anyway, to be printed
         % in case the procedure has a mode error.
         ArmContext = goal_info_get_context(ArmInfo0),
-        report_missing_inits_in_disjunct(ArmContext, UninitVarNames,
-            !Warnings)
+        report_missing_inits_in_disjunct(ArmContext, UninitVarNames, !Specs)
     ),
     goal_info_set_goal_id(ArmId, ArmInfo0, ArmInfo),
     Arm = hlds_goal(ArmExpr, ArmInfo),
     !:RevArms = [Arm | !.RevArms],
     merge_changes_made_by_arms(ArmStates, StatusMapBefore,
         ChangedStatusListAfter, VarSet, !RevArms,
-        !NextGoalId, !DelayedRenamings, !Warnings).
+        !NextGoalId, !DelayedRenamings, !Specs).
 
 :- pred handle_arm_updated_state_vars(assoc_list(svar, svar_status)::in,
     map(svar, svar_status)::in, map(svar, svar_status)::in,
@@ -1058,7 +1058,14 @@
         expect_not(unify(AfterArmStatus, AfterAllArmsStatus),
             $pred, "AfterArmStatus = AfterAllArmsStatus"),
         (
-            BeforeStatus = status_known(BeforeVar),
+            % If the state var is readonly in this context, then it shouldn't
+            % have been updated by any arms. However, if it was, then we have
+            % (a) already generated an error message for it, and (b) changed
+            % its status to writeable to suppress duplicate error messages.
+            % This is why this code treats known_ro the same as known.
+            ( BeforeStatus = status_known(BeforeVar)
+            ; BeforeStatus = status_known_ro(BeforeVar, _, _)
+            ),
             (
                 AfterAllArmsStatus = status_known(AfterAllVar),
                 make_copy_goal(BeforeVar, AfterAllVar, CopyGoal),
@@ -1090,9 +1097,6 @@
             % known updated prog_var, and thus AfterAllArmsStatus should be
             % the same as StatusBefore, which means we shouldn't get here.
             unexpected($module, $pred, "BeforeStatus is updated")
-        ;
-            BeforeStatus = status_known_ro(_, _, _),
-            unexpected($module, $pred, "BeforeStatus = status_known_ro")
         )
     ;
         (
@@ -1206,19 +1210,19 @@
         ThenMissingInits = []
     ;
         ThenMissingInits = [_ | _],
-        ThenWarnings0 = !.Store ^ store_warnings,
+        ThenSpecs0 = !.Store ^ store_specs,
         report_missing_inits_in_ite(Context, ThenMissingInits,
-            "succeeds", "fails", ThenWarnings0, ThenWarnings),
-        !Store ^ store_warnings := ThenWarnings
+            "succeeds", "fails", ThenSpecs0, ThenSpecs),
+        !Store ^ store_specs := ThenSpecs
     ),
     (
         ElseMissingInits = []
     ;
         ElseMissingInits = [_ | _],
-        ElseWarnings0 = !.Store ^ store_warnings,
+        ElseSpecs0 = !.Store ^ store_specs,
         report_missing_inits_in_ite(Context, ThenMissingInits,
-            "fails", "succeeds", ElseWarnings0, ElseWarnings),
-        !Store ^ store_warnings := ElseWarnings
+            "fails", "succeeds", ElseSpecs0, ElseSpecs),
+        !Store ^ store_specs := ElseSpecs
     ),
 
     svar_goal_to_conj_list(ThenGoal0, ThenGoals0, !Store),
@@ -1230,7 +1234,7 @@
     conj_list_to_goal(ThenGoals, ThenInfo0, ThenGoal1),
     conj_list_to_goal(ElseGoals, ElseInfo0, ElseGoal1),
 
-    !.Store = svar_store(NextGoalId0, DelayedRenamings0, Warnings),
+    !.Store = svar_store(NextGoalId0, DelayedRenamings0, Specs),
     counter.allocate(ThenGoalIdNum, NextGoalId0, NextGoalId1),
     counter.allocate(ElseGoalIdNum, NextGoalId1, NextGoalId),
     ThenGoalId = goal_id(ThenGoalIdNum),
@@ -1241,7 +1245,7 @@
         DelayedRenamings0, DelayedRenamings1),
     map.det_insert(ElseGoalId, ElseRenames,
         DelayedRenamings1, DelayedRenamings),
-    !:Store = svar_store(NextGoalId, DelayedRenamings, Warnings).
+    !:Store = svar_store(NextGoalId, DelayedRenamings, Specs).
 
 :- pred handle_state_vars_in_ite(loc_kind::in, list(svar)::in, list(svar)::in,
     map(svar, svar_status)::in, map(svar, svar_status)::in,
@@ -1824,14 +1828,14 @@
     % modulo the differences in the argument list.
     Goal = hlds_goal(GoalExpr, GoalInfo),
     ( GoalExpr = conj(plain_conj, Conjuncts0) ->
-        !.Store = svar_store(NextGoalId0, DelayedRenamingMap0, Warnings),
+        !.Store = svar_store(NextGoalId0, DelayedRenamingMap0, Specs),
         GoalId = goal_info_get_goal_id(GoalInfo),
         ( map.search(DelayedRenamingMap0, GoalId, GoalDelayedRenaming) ->
             list.map_foldl2(
                 add_conjunct_delayed_renames(GoalDelayedRenaming),
                     Conjuncts0, Conjuncts, NextGoalId0, NextGoalId,
                     DelayedRenamingMap0, DelayedRenamingMap),
-            !:Store = svar_store(NextGoalId, DelayedRenamingMap, Warnings)
+            !:Store = svar_store(NextGoalId, DelayedRenamingMap, Specs)
         ;
             Conjuncts = Conjuncts0
         )
@@ -2034,3 +2038,9 @@
     !:Specs = [Spec | !.Specs].
 
 %-----------------------------------------------------------------------------%
+
+:- pred severity_is_error(error_spec::in) is semidet.
+
+severity_is_error(error_spec(severity_error, _, _)).
+
+%-----------------------------------------------------------------------------%
Index: compiler/superhomogeneous.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/superhomogeneous.m,v
retrieving revision 1.44
diff -u -b -r1.44 superhomogeneous.m
--- compiler/superhomogeneous.m	6 May 2011 05:03:24 -0000	1.44
+++ compiler/superhomogeneous.m	15 May 2011 07:45:19 -0000
@@ -1194,5 +1194,5 @@
     ).
 
 %-----------------------------------------------------------------------------%
-:- end_module superhomogeneous.
+:- end_module hlds.make_hlds.superhomogeneous.
 %-----------------------------------------------------------------------------%
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/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/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
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.244
diff -u -b -r1.244 Mmakefile
--- tests/invalid/Mmakefile	29 Dec 2010 04:52:23 -0000	1.244
+++ tests/invalid/Mmakefile	16 May 2011 05:00:03 -0000
@@ -49,6 +49,7 @@
 	bind_var_errors \
 	bug113 \
 	bug150 \
+	bug197 \
 	bug83 \
 	builtin_int \
 	builtin_proc \
Index: tests/invalid/bug197.err_exp
===================================================================
RCS file: tests/invalid/bug197.err_exp
diff -N tests/invalid/bug197.err_exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/bug197.err_exp	15 May 2011 08:01:21 -0000
@@ -0,0 +1,15 @@
+bug197.m:020: Error: no clauses for predicate `foo'/4.
+bug197.m:022: Error: clause for predicate `bug197.foo'/3
+bug197.m:022:   without preceding `pred' declaration.
+bug197.m:023: In clause for predicate `foo'/3:
+bug197.m:023:   in argument 1 of call to predicate `list.foldl'/4:
+bug197.m:023:   type error: argument has type `pred(string, T, V_6, V_6)',
+bug197.m:023:   expected type was `pred(L, A, A)'.
+bug197.m:028: In clause for predicate `bug197.foo'/3:
+bug197.m:028:   warning: variable `STATE_VARIABLE_SS_20' occurs only once in
+bug197.m:028:   this scope.
+bug197.m:028: Error: cannot use !:SS here due to the surrounding lambda
+bug197.m:028:   expression; you may only refer to !.SS.
+bug197.m:023:   Here is the surrounding context that makes state variable SS
+bug197.m:023:   readonly.
+For more information, recompile with `-E'.
Index: tests/invalid/bug197.m
===================================================================
RCS file: tests/invalid/bug197.m
diff -N tests/invalid/bug197.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/bug197.m	13 May 2011 08:02:16 -0000
@@ -0,0 +1,34 @@
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+% 
+% The following program causes Mercury 11.01 to abort with
+% Uncaught Mercury exception:
+% Software Error: hlds.make_hlds.state_var: predicate
+% `hlds.make_hlds.state_var.handle_arm_updated_state_vars'/7: Unexpected:
+% BeforeStatus = status_known_ro
+%
+% (Compile with mmc -C )
+
+:- module bug197.
+:- interface.
+
+:- type ss ---> ss.
+
+:- implementation.
+
+:- import_module list.
+
+:- pred foo(string::in, list(T)::in, ss::mdi, ss::muo) is semidet.
+
+foo(Ls, !SS) :-
+	list.foldl((pred(Name::in, L::in, !.A::in, !:A::out) is semidet :-
+		(
+			Name = "foo"
+		;
+			Name = "bar",
+			bar(L, !SS)
+		)
+	), Ls, 10, _).
+
+:- pred bar(T::in, ss::mdi, ss::muo) is semidet.
+
+bar(_, !SS) :- semidet_fail.
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