From: Jérémie Astor Date: Sun, 24 May 2020 13:44:35 +0000 (+0200) Subject: :bug: Fix auto loop X-Git-Tag: nightly~1525 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=91ef113c6da60112a94295087a55d354127834fe;p=gwion.git :bug: Fix auto loop --- diff --git a/src/parse/check.c b/src/parse/check.c index 87a02f76..45796a72 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -985,10 +985,10 @@ ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { struct Array_Sub_ array = {}; Type_Decl *td0 = type2td(env, ptr, stmt->exp->pos), td = { .xid=insert_symbol("Ptr"), .types=&tl, .pos=stmt->exp->pos }; - tl.td = td0; + tl.td = td0; if(depth) { array.depth = depth; - td.array = &array; + td0->array = &array; } ptr = known_type(env, &td); td0->array = NULL; @@ -999,7 +999,7 @@ ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { CHECK_BB(envset_run(&es, get_type(ptr))) } } - t = depth ? array_type(env, ptr, depth) : ptr; + t = (!stmt->is_ptr && depth) ? array_type(env, ptr, depth) : ptr; stmt->v = new_value(env->gwion->mp, t, s_name(stmt->sym)); SET_FLAG(stmt->v, valid); nspc_add_value(env->curr, stmt->sym, stmt->v);