From 4359a43732b7ffa63366193591828c4e2d6e384f Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 30 Jun 2018 19:29:34 +0100 Subject: [PATCH] compiler: Indirection status of TTuple depends on elements For instance, TTuple(TList(TInt32())) has indirections, while TTuple(TInt32()) does not. This fixes memory corruption with RPCs that return tuples of lists. Signed-off-by: David Nadlinger --- artiq/compiler/builtins.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/builtins.py b/artiq/compiler/builtins.py index 77e102d3b..1d69bcbae 100644 --- a/artiq/compiler/builtins.py +++ b/artiq/compiler/builtins.py @@ -311,9 +311,11 @@ def is_collection(typ): types.is_mono(typ, "list") def is_allocated(typ): + if types.is_tuple(typ): + return any(is_allocated(e.find()) for e in typ.elts) return not (is_none(typ) or is_bool(typ) or is_int(typ) or is_float(typ) or is_range(typ) or types._is_pointer(typ) or types.is_function(typ) or types.is_c_function(typ) or types.is_rpc(typ) or - types.is_method(typ) or types.is_tuple(typ) or + types.is_method(typ) or types.is_value(typ))