From df8e891b2190daaa688f549820593534de6e4fad Mon Sep 17 00:00:00 2001 From: Yakup Budanaz Date: Sat, 9 Nov 2024 16:08:16 +0100 Subject: [PATCH] Add correct typecast --- dace/codegen/targets/cpu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dace/codegen/targets/cpu.py b/dace/codegen/targets/cpu.py index ff03c8c245..ab6b5f3d81 100644 --- a/dace/codegen/targets/cpu.py +++ b/dace/codegen/targets/cpu.py @@ -494,7 +494,7 @@ def allocate_array(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg: StateSubgraphV if not declared: declaration_stream.write(f'{nodedesc.dtype.ctype} *{name};\n', cfg, state_id, node) allocation_stream.write( - "%s = std::aligned_alloc(64, %s * sizeof(%s));\n" % (alloc_name, cpp.sym2cpp(arrsize), nodedesc.dtype.ctype), cfg, + "%s = static_cast<{nodedesc.dtype.ctype}*>(std::aligned_alloc(64, %s * sizeof(%s)));\n" % (alloc_name, cpp.sym2cpp(arrsize), nodedesc.dtype.ctype), cfg, state_id, node) define_var(name, DefinedType.Pointer, ctypedef) @@ -544,7 +544,7 @@ def allocate_array(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg: StateSubgraphV """ #pragma omp parallel {{ - {name} = ({ctype}*)std::aligned_alloc(64, {arrsize} * sizeof({ctype}));""".format(ctype=nodedesc.dtype.ctype, + {name} = static_cast<{ctype}*>(std::aligned_alloc(64, {arrsize} * sizeof({ctype})));""".format(ctype=nodedesc.dtype.ctype, name=alloc_name, arrsize=cpp.sym2cpp(arrsize)), cfg,