[m-rev.] diff: fix a second lco bug
Zoltan Somogyi
zs at csse.unimelb.edu.au
Thu Mar 10 16:44:39 AEDT 2011
Fix another problem with lco reported by Michael Day. The problem was that
(a) the hlc backend always passes floats as unboxed entities, but stored in
structures in boxed form, and (b) the lco transformation can change float
arguments from being passed in structures to being passed as arguments.
The problem is that the argument will be a pointer to an UNBOXED float,
even though the structure field whose address supplies the value of the
pointer is supposed to contain a BOXED float.
compiler/lco.m:
Look for this situation, and if it arises, don't apply lco.
tests/hard_coded/lco_mday_bug_{1,2}.{m,exp}:
Two versions of the test case that exhibit this bug. The first version
works with floats, and shows the bug; the second replaces the floats
with strings, and it works even without this fix. This proves that the
problem was one described above.
tests/hard_coded/Mmakefiles:
tests/hard_coded/Mercury.options:
Enable the new test cases, and compile them with lco.
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/lco.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.64
diff -u -b -r1.64 lco.m
--- compiler/lco.m 8 Mar 2011 07:37:37 -0000 1.64
+++ compiler/lco.m 9 Mar 2011 07:11:24 -0000
@@ -185,6 +185,7 @@
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_mode.
+:- import_module parse_tree.prog_type.
:- import_module parse_tree.prog_util.
:- import_module transform_hlds.dependency_graph.
@@ -239,13 +240,17 @@
:- type variant_map == multi_map(pred_proc_id, variant_id).
-:- type permitted
- ---> permitted
- ; not_permitted.
-
-:- type changed
- ---> changed
- ; not_changed.
+:- type lco_is_permitted_on_scc
+ ---> lco_is_not_permitted_on_scc
+ ; lco_is_permitted_on_scc.
+
+:- type proc_changed
+ ---> proc_not_changed
+ ; proc_changed.
+
+:- type allow_float_addr
+ ---> do_not_allow_float_addr
+ ; allow_float_addr.
:- type lco_info
---> lco_info(
@@ -253,8 +258,9 @@
lco_cur_scc_variants :: variant_map,
lco_var_set :: prog_varset,
lco_var_types :: vartypes,
- lco_permitted :: permitted,
- lco_changed :: changed
+ lco_allow_float_addr :: allow_float_addr,
+ lco_permitted :: lco_is_permitted_on_scc,
+ lco_changed :: proc_changed
).
:- type lco_const_info
@@ -284,19 +290,19 @@
hlds_dependency_info_get_dependency_ordering(DepInfo, SCCs),
list.foldl2(lco_scc, SCCs, map.init, _, !ModuleInfo).
- % XXX did we forget to add CurSCCVariants to !VariantMap?
:- pred lco_scc(list(pred_proc_id)::in, variant_map::in, variant_map::out,
module_info::in, module_info::out) is det.
lco_scc(SCC, !VariantMap, !ModuleInfo) :-
+ % XXX did we forget to add CurSCCVariants to !VariantMap?
ModuleInfo0 = !.ModuleInfo,
list.foldl4(lco_proc(!.VariantMap, SCC), SCC, !ModuleInfo,
map.init, CurSCCVariantMap, map.init, CurSCCUpdateMap,
- permitted, Permitted),
+ lco_is_permitted_on_scc, Permitted),
multi_map.to_flat_assoc_list(CurSCCVariantMap, CurSCCVariants),
map.to_assoc_list(CurSCCUpdateMap, CurSCCUpdates),
(
- Permitted = permitted,
+ Permitted = lco_is_permitted_on_scc,
CurSCCUpdates = [_ | _]
->
list.foldl(lco_process_proc_update, CurSCCUpdates, !ModuleInfo),
@@ -373,14 +379,14 @@
pred_proc_id::in, module_info::in, module_info::out,
variant_map::in, variant_map::out,
map(pred_proc_id, proc_info)::in, map(pred_proc_id, proc_info)::out,
- permitted::in, permitted::out) is det.
+ lco_is_permitted_on_scc::in, lco_is_permitted_on_scc::out) is det.
lco_proc(LowerSCCVariants, SCC, CurProc, !ModuleInfo, !CurSCCVariants,
!CurSCCUpdates, !Permitted) :-
(
- !.Permitted = not_permitted
+ !.Permitted = lco_is_not_permitted_on_scc
;
- !.Permitted = permitted,
+ !.Permitted = lco_is_permitted_on_scc,
CurProc = proc(PredId, ProcId),
module_info_pred_proc_info(!.ModuleInfo, PredId, ProcId,
PredInfo, ProcInfo0),
@@ -392,7 +398,7 @@
; not acceptable_detism_for_lco(Detism)
)
->
- !:Permitted = not_permitted
+ !:Permitted = lco_is_not_permitted_on_scc
;
proc_info_get_varset(ProcInfo0, VarSet0),
proc_info_get_vartypes(ProcInfo0, VarTypes0),
@@ -407,15 +413,40 @@
CurProc, PredInfo, ProcInfo0, OutputHeadVars, CurProcDetism,
HighLevelData),
module_info_get_globals(!.ModuleInfo, Globals),
+ globals.lookup_bool_option(Globals, highlevel_code,
+ HighLevelCode),
+ (
+ HighLevelCode = yes,
+ % At the moment, the hlc backend boxes floats when they appear
+ % as arguments in structures (even on 64 bit platforms), but
+ % NOT when it passes them as stand-alone arguments. When this
+ % pass transforms the HLDS, if the to-be-filled-in-later slot
+ % contains a Mercury float, the code generated by the hlc
+ % backend (and probably the other MLDS backeds) will take
+ % the address of a boxed float, and casts it to be a pointer
+ % to an unboxed float. The callee then fills in the pointed-to
+ % location with a float, the caller interprets this as a
+ % boxed float i.e. a pointer to a float, and you get a
+ % core dump.
+ AllowFloatAddr = do_not_allow_float_addr
+ ;
+ HighLevelCode = no,
+ % The low level backend does not suffer from the problem:
+ % if sizeof(double) == sizeof(void *), it uses unboxed
+ % floats in both places (structures and arguments); if they are
+ % of different sizes, it uses boxed floats in both places.
+ AllowFloatAddr = allow_float_addr
+ ),
Info0 = lco_info(!.ModuleInfo, !.CurSCCVariants,
- VarSet0, VarTypes0, permitted, not_changed),
+ VarSet0, VarTypes0, AllowFloatAddr,
+ lco_is_permitted_on_scc, proc_not_changed),
proc_info_get_goal(ProcInfo0, Goal0),
lco_in_goal(Goal0, Goal, Info0, Info, ConstInfo),
- Info = lco_info(!:ModuleInfo, !:CurSCCVariants, VarSet,
- VarTypes, !:Permitted, Changed),
+ Info = lco_info(!:ModuleInfo, !:CurSCCVariants,
+ VarSet, VarTypes, _AllowFloatAddr, !:Permitted, Changed),
(
- !.Permitted = permitted,
- Changed = changed
+ !.Permitted = lco_is_permitted_on_scc,
+ Changed = proc_changed
->
trace [compiletime(flag("lco")), io(!IO)] (
io.write_string("\ngoal before lco:\n", !IO),
@@ -484,7 +515,7 @@
;
ConjType = parallel_conj,
GoalExpr = GoalExpr0,
- !Info ^ lco_permitted := not_permitted
+ !Info ^ lco_permitted := lco_is_not_permitted_on_scc
)
;
GoalExpr0 = disj(Goals0),
@@ -708,7 +739,7 @@
UpdatedGoal = hlds_goal(UpdatedGoalExpr, UpdatedGoalInfo),
Goals = list.reverse(RevGoals) ++ UpdatedUnifies ++ [UpdatedGoal],
MaybeGoals = yes(Goals),
- !Info ^ lco_changed := changed
+ !Info ^ lco_changed := proc_changed
;
% The reversed conjunction does not follow the pattern we are looking
% for, so we cannot optimize it.
@@ -792,6 +823,16 @@
[UpdatedCallArg | UpdatedCallArgs], !Subst, !Info) :-
find_args_to_pass_by_addr(ConstInfo, UnifyInputVars, CallHeadArgs,
ArgNum + 1, MismatchesTail, UpdatedCallArgs, !Subst, !Info),
+ (
+ !.Info ^ lco_allow_float_addr = do_not_allow_float_addr,
+ map.lookup(!.Info ^ lco_var_types, CallArg, CallArgType),
+ type_to_ctor(CallArgType, CallArgTypeCtor),
+ CallArgTypeCtor = type_ctor(unqualified("float"), 0)
+ ->
+ !Info ^ lco_permitted := lco_is_not_permitted_on_scc
+ ;
+ true
+ ),
( CallArg = HeadArg ->
UpdatedCallArg = CallArg,
Mismatches = MismatchesTail,
@@ -819,7 +860,7 @@
% Instead, we just disable the application of the lco
% transformation to this call.
- !Info ^ lco_permitted := not_permitted
+ !Info ^ lco_permitted := lco_is_not_permitted_on_scc
;
true
)
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
Index: tests/hard_coded/Mercury.options
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mercury.options,v
retrieving revision 1.48
diff -u -b -r1.48 Mercury.options
--- tests/hard_coded/Mercury.options 8 Mar 2011 07:37:44 -0000 1.48
+++ tests/hard_coded/Mercury.options 9 Mar 2011 07:05:19 -0000
@@ -42,6 +42,8 @@
MCFLAGS-intermod_type_qual2 = --intermodule-optimization
MCFLAGS-intermod_multimode = --intermodule-optimization
MCFLAGS-intermod_multimode_main = --intermodule-optimization
+MCFLAGS-lco_mday_bug_1 = --optimize-constructor-last-call
+MCFLAGS-lco_mday_bug_2 = --optimize-constructor-last-call
MCFLAGS-lco_no_inline = --optimize-constructor-last-call --no-inline-builtins
MCFLAGS-lookup_switch_simple_non = --no-warn-det-decls-too-lax
MCFLAGS-opt_format = --optimize-format-calls
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.398
diff -u -b -r1.398 Mmakefile
--- tests/hard_coded/Mmakefile 8 Mar 2011 07:37:44 -0000 1.398
+++ tests/hard_coded/Mmakefile 9 Mar 2011 07:04:51 -0000
@@ -148,6 +148,8 @@
intermod_unused_args \
java_rtti_bug \
join_list \
+ lco_mday_bug_1 \
+ lco_mday_bug_2 \
lco_no_inline \
list_series_int \
lookup_disj \
Index: tests/hard_coded/lco_mday_bug_1.exp
===================================================================
RCS file: tests/hard_coded/lco_mday_bug_1.exp
diff -N tests/hard_coded/lco_mday_bug_1.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/lco_mday_bug_1.exp 9 Mar 2011 07:02:56 -0000
@@ -0,0 +1,3 @@
+num_float(43.0)
+float 41.0
+num_float(41.0)
Index: tests/hard_coded/lco_mday_bug_1.m
===================================================================
RCS file: tests/hard_coded/lco_mday_bug_1.m
diff -N tests/hard_coded/lco_mday_bug_1.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/lco_mday_bug_1.m 9 Mar 2011 07:02:31 -0000
@@ -0,0 +1,74 @@
+% vim: ts=4 sw=4 et ft=mercury
+
+:- module lco_mday_bug_1.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io, io).
+:- mode main(di, uo) is det.
+
+:- implementation.
+
+:- import_module int, float.
+
+:- type number
+ ---> num_int(int)
+ ; num_float(float).
+
+:- type standard_func
+ ---> date_func
+ ; date_parse.
+
+main(!IO) :-
+ p(X),
+ io.write(num_float(X), !IO),
+ io.nl(!IO),
+ call_standard_func(date_parse, Res),
+ (
+ Res = num_int(I),
+ io.write_string("int ", !IO),
+ io.write_int(I, !IO),
+ io.nl(!IO)
+ ;
+ Res = num_float(F),
+ io.write_string("float ", !IO),
+ io.write_float(F, !IO),
+ io.nl(!IO)
+ ),
+ io.write(Res, !IO),
+ io.nl(!IO).
+
+%--------------------------------------------------------------------%
+
+:- pragma no_inline(p/1).
+:- pred p(float::out) is det.
+
+p(43.0).
+
+%--------------------------------------------------------------------%
+
+:- pred call_standard_func(standard_func, number).
+:- mode call_standard_func(in, out) is det.
+
+call_standard_func(date_func, Res) :-
+ Res = num_int(0).
+call_standard_func(date_parse, Res) :-
+ to_integer(num_int(0), T),
+ Res = num_float(T).
+
+%--------------------------------------------------------------------%
+
+:- pred to_integer(number, float).
+:- mode to_integer(in, out) is det.
+
+to_integer(N0, N) :-
+ (
+ N0 = num_int(_),
+ N = 41.0
+ ;
+ N0 = num_float(_),
+ call_standard_func(date_func, _Res2),
+ N = 42.0
+ ).
Index: tests/hard_coded/lco_mday_bug_2.exp
===================================================================
RCS file: tests/hard_coded/lco_mday_bug_2.exp
diff -N tests/hard_coded/lco_mday_bug_2.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/lco_mday_bug_2.exp 9 Mar 2011 07:03:53 -0000
@@ -0,0 +1 @@
+num_float("41")
Index: tests/hard_coded/lco_mday_bug_2.m
===================================================================
RCS file: tests/hard_coded/lco_mday_bug_2.m
diff -N tests/hard_coded/lco_mday_bug_2.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/lco_mday_bug_2.m 9 Mar 2011 07:03:37 -0000
@@ -0,0 +1,51 @@
+:- module lco_mday_bug_2.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io, io).
+:- mode main(di, uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+:- type number
+ ---> num_int(int)
+ ; num_float(string).
+
+:- type standard_func
+ ---> date_func
+ ; date_parse.
+
+main(!IO) :-
+ call_standard_func(date_parse, Res),
+ io.write(Res, !IO),
+ io.nl(!IO).
+
+%--------------------------------------------------------------------%
+
+:- pred call_standard_func(standard_func, number).
+:- mode call_standard_func(in, out) is det.
+
+call_standard_func(date_func, Res) :-
+ Res = num_int(0).
+call_standard_func(date_parse, Res) :-
+ to_integer(num_int(0), T),
+ Res = num_float(T).
+
+%--------------------------------------------------------------------%
+
+:- pred to_integer(number, string).
+:- mode to_integer(in, out) is det.
+
+to_integer(N0, N) :-
+ (
+ N0 = num_int(_),
+ N = "41"
+ ;
+ N0 = num_float(_),
+ call_standard_func(date_func, _Res2),
+ N = "42"
+ ).
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
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