[m-rev.] diff: avoid integer overflow in deep profiling runtime

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 15 14:56:27 AEDT 2007


Estimated hours taken: 0.1
Branches: main

Avoid integer overflow on 64-bit machines in the runtime code that writes
out deep profiles.

runtime/mercury_deep_profiling.c:
 	Update some assertions to work correctly on 64-bit machines.

Julien.

Index: runtime/mercury_deep_profiling.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling.c,v
retrieving revision 1.27
diff -u -r1.27 mercury_deep_profiling.c
--- runtime/mercury_deep_profiling.c	12 Sep 2007 06:21:15 -0000	1.27
+++ runtime/mercury_deep_profiling.c	15 Nov 2007 03:53:02 -0000
@@ -1388,7 +1388,7 @@
      }
  #endif

-    MR_deep_assert(NULL, NULL, NULL, (int) num >= 0);
+    MR_deep_assert(NULL, NULL, NULL, (MR_Integer) num >= 0);

      i = 0;
      do {
@@ -1416,7 +1416,7 @@
      }
  #endif

-    MR_deep_assert(NULL, NULL, NULL, (int) num >= 0);
+    MR_deep_assert(NULL, NULL, NULL, (MR_Integer) num >= 0);

      for (i = 0; i < MR_FIXED_SIZE_INT_BYTES; i++) {
          putc(num & ((1 << 8) - 1), fp);

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