[m-rev.] diff: fix problem with foreign enums on 64-bit machines (bug #189)

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Mar 16 12:43:39 AEDT 2011


Branches: main, 11.01

Fix bug #189 - the reference manual specifies that for the C interface foreign
enumeration values may be at least as large as sizeof(MR_Integer), but the
MR_ForeignEnumFunctorDesc structure was only storing the first 32 bits of a
foreign enumeration value.  This is incorrect on machines where MR_Integer is a
64-bit value as on such machines foreign enumeration values may also use up to
64-bits.

runtime/mercury_ml_expand_body.h
runtime/mercury_type_info.h:
 	Use MR_Integer for foreign enum values instead MR_int_least32_t.

Julien.

Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.41
diff -u -r1.41 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	20 Aug 2007 03:36:15 -0000	1.41
+++ runtime/mercury_ml_expand_body.h	16 Mar 2011 00:18:22 -0000
@@ -340,7 +340,7 @@
                  int                 num_functors;
                  MR_ConstString      functor_name = NULL;
                  MR_int_least32_t    functor_ordinal = -1;
-                MR_int_least32_t    functor_value;
+                MR_Integer          functor_value;

                  num_functors = MR_type_ctor_num_functors(type_ctor_info);

Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.131
diff -u -r1.131 mercury_type_info.h
--- runtime/mercury_type_info.h	25 Jan 2010 05:26:04 -0000	1.131
+++ runtime/mercury_type_info.h	16 Mar 2011 00:17:59 -0000
@@ -934,7 +934,7 @@
  typedef struct {
      MR_ConstString      MR_foreign_enum_functor_name;
      MR_int_least32_t    MR_foreign_enum_functor_ordinal;
-    MR_int_least32_t    MR_foreign_enum_functor_value;
+    MR_Integer          MR_foreign_enum_functor_value;
  } MR_ForeignEnumFunctorDesc;

  typedef const MR_ForeignEnumFunctorDesc     *MR_ForeignEnumFunctorDescPtr;

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