[m-rev.] for review: initialise foreign_proc dummy input args to zero

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jul 26 15:33:39 AEST 2007


Estimated hours taken: 1
Branches: main

Fix the failure of hard_coded/ee_dummy in low-level C grades.
It was failing because it tested the value of an exported
enumeration constant for a dummy type against the value of a variable
that corresponds to a foreign_proc input argument of that type.

The low-level C backend was not zeroing out the values of dummy input
arguments to foreign_procs, so they just contained rubbish and the
comparison failed.  The fix is to initialise the values of the variables
that correspond to the foreign_proc dummy input argument to zero.
(The high-level C backend does already does this.

compiler/llds_out.m:
 	Initialise the variables that correspond to foreign_proc
 	dummy input arguments to zero.

Julien.

Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.312
diff -u -r1.312 llds_out.m
--- compiler/llds_out.m	17 Jul 2007 23:48:26 -0000	1.312
+++ compiler/llds_out.m	26 Jul 2007 05:22:26 -0000
@@ -2705,10 +2705,11 @@

  output_foreign_proc_inputs([], !IO).
  output_foreign_proc_inputs([Input | Inputs], !IO) :-
-    Input = foreign_proc_input(_VarName, _VarType, IsDummy, _OrigType, _Rval,
+    Input = foreign_proc_input(VarName, _VarType, IsDummy, _OrigType, _Rval,
          _MaybeForeignTypeInfo, _BoxPolicy),
      (
-        IsDummy = yes
+        IsDummy = yes,
+        io.write_string("\t" ++ VarName ++ " = 0;\n", !IO)
      ;
          IsDummy = no,
          output_foreign_proc_input(Input, !IO)


--------------------------------------------------------------------------
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