From 86e006830cce0e15824501a3c1deab6dd2de01d8 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 22 Jul 2015 03:05:15 +0300 Subject: [PATCH] Use the correct printf format for 64-bit integers. --- artiq/compiler/transforms/artiq_ir_generator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/transforms/artiq_ir_generator.py b/artiq/compiler/transforms/artiq_ir_generator.py index c7e633295..ab74a2374 100644 --- a/artiq/compiler/transforms/artiq_ir_generator.py +++ b/artiq/compiler/transforms/artiq_ir_generator.py @@ -1339,7 +1339,13 @@ class ARTIQIRGenerator(algorithm.Visitor): ir.Constant("True", builtins.TStr()), ir.Constant("False", builtins.TStr())))) elif builtins.is_int(value.type): - format_string += "%d" + width = builtins.get_int_width(value.type) + if width <= 32: + format_string += "%ld" + elif width <= 64: + format_string += "%lld" + else: + assert False args.append(value) elif builtins.is_float(value.type): format_string += "%g"