[m-rev.] diff: fix abort in compiler built with MSVC
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Oct 7 06:01:48 AEDT 2011
Branches: main, 11.07
Fix a problem that causes a compiler built using MSVC to abort when compiling
the standard library (or anything else for that matter).
library/io.m:
Fix an old XXX: don't assume that sizeof(time_t) <= sizeof(MR_Word).
For MSVC that isn't true.
Julien.
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.466
diff -u -r1.466 io.m
--- library/io.m 9 Sep 2011 17:42:49 -0000 1.466
+++ library/io.m 6 Oct 2011 18:53:08 -0000
@@ -1690,6 +1690,7 @@
%-----------------------------------------------------------------------------%
+:- pragma foreign_import_module("C", time). % For ML_construct_time_t.
:- pragma foreign_import_module("C", string).
% Values of type `io.state' are never really used:
@@ -2846,8 +2847,7 @@
#ifdef MR_HAVE_STAT
struct stat s;
if (stat(FileName, &s) == 0) {
- /* XXX This assumes that a time_t will fit into an MR_Word. */
- Time = s.st_mtime;
+ Time = ML_construct_time_t(s.st_mtime);
Msg = MR_string_const("""", 0);
Status = 1;
} else {
--------------------------------------------------------------------------
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