[m-rev.] diff: fix failure of hard_coded/copy_pred_2 on saturn in hlc.gc

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 16 18:53:46 AEDT 2007


This is still pending a bootcheck.

Estimated hours taken: 6
Branches: main

Fix a bug that was causing hard_coded/copy_pred_2 to fail on 64-bit machines
in hlc* grades.  The problem was that the MLDS->C code generator was
inconsistent in how it mapped the the mlds_native_{int,float,char}_type to
C, e.g. sometimes they were MR_Integers and sometimes they were ints.

On machines were MR_Integer is not an int, e.g. saturn where it's a long,
this caused the test case to fail.  The actual test case failure was caused
by the fact that typevar_vector array in the closure layout was declared to
be an array of ints while the compiler was trying to put values of type
MR_Integer into it.  This didn't work since (on saturn) the array was half
the size it needed to be.  (The actual test case failure occurred when deep
copy was trying to use the closure layout to make a copy of the closure.)

compiler/mlds_to_c.m:
 	Fix an inconsistency with how we map MLDS types to C types.

Julien.

Index: mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.208
diff -u -r1.208 mlds_to_c.m
--- mlds_to_c.m	8 Jan 2007 03:03:13 -0000	1.208
+++ mlds_to_c.m	16 Jan 2007 07:44:39 -0000
@@ -2076,13 +2076,13 @@
          io.write_string("MR_ArrayPtr", !IO)
      ).
  mlds_output_type_prefix(mlds_native_int_type, !IO) :-
-    io.write_string("int", !IO).
+    io.write_string("MR_Integer", !IO).
  mlds_output_type_prefix(mlds_native_float_type, !IO) :-
-    io.write_string("float", !IO).
+    io.write_string("MR_Float", !IO).
  mlds_output_type_prefix(mlds_native_bool_type, !IO) :-
      io.write_string("MR_bool", !IO).
  mlds_output_type_prefix(mlds_native_char_type, !IO) :-
-    io.write_string("char", !IO).
+    io.write_string("MR_Char", !IO).
  mlds_output_type_prefix(mlds_foreign_type(_ForeignType), !IO) :-
      % For binary compatibility with the --target asm back-end,
      % we need to output these as a generic type, rather than making

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