From c6fa9d2d431c3fcd728919dc2cd6f0f2d54b8316 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 28 Jul 2017 08:21:04 +0000 Subject: [PATCH] PM_ExportVector.cc: Fix export_string format string to get correct output for state rewards export (issue #16) Fixes https://github.com/prismmodelchecker/prism/issues/16. In SVN commit 12019 (https://github.com/prismmodelchecker/prism-svn/commit/1d8f9fc6b9a8ec44ade8f7dbc04b3688f8f95bc5), we converted the ODD indizes from long to int64_t to get the same size in 32/64bit on Linux / OS X and Windows. With this change, the format string used here became incorrect and, on 32bit Linux, the second "%.0f" printing takes its value from part of the first argument instead of from the double returned by DD_GetNumMinterms. Now, we use the PRId64 macro to get the correct format string parameter. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@12177 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/mtbdd/PM_ExportVector.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prism/src/mtbdd/PM_ExportVector.cc b/prism/src/mtbdd/PM_ExportVector.cc index 66786f82..c1726f72 100644 --- a/prism/src/mtbdd/PM_ExportVector.cc +++ b/prism/src/mtbdd/PM_ExportVector.cc @@ -66,8 +66,8 @@ jstring fn // filename // print file header switch (export_type) { - case EXPORT_PLAIN: export_string("%d %.0f\n", odd->eoff+odd->toff, DD_GetNumMinterms(ddman, vector, num_vars)); break; - case EXPORT_MATLAB: export_string("%s = sparse(%d,1);\n", export_name, odd->eoff+odd->toff); break; + case EXPORT_PLAIN: export_string("%" PRId64 " %.0f\n", odd->eoff+odd->toff, DD_GetNumMinterms(ddman, vector, num_vars)); break; + case EXPORT_MATLAB: export_string("%s = sparse(%" PRId64 ",1);\n", export_name, odd->eoff+odd->toff); break; } // print main part of file