Fix segfault in AST simplify
authorClifford Wolf <clifford@clifford.at>
Tue, 18 Dec 2018 16:49:38 +0000 (17:49 +0100)
committerClifford Wolf <clifford@clifford.at>
Tue, 18 Dec 2018 16:49:38 +0000 (17:49 +0100)
(as proposed by Dan Gisselquist)

Signed-off-by: Clifford Wolf <clifford@clifford.at>
frontends/ast/simplify.cc

index 55abe165f87b012d13426546f40cb85e8b54d4df..83714f897390177f93a7dd68d3b68011c2be8e21 100644 (file)
@@ -1810,6 +1810,11 @@ skip_dynamic_range_lvalue_expansion:;
 
                                log_assert(block != nullptr);
 
+                               if (num_steps == 0) {
+                                       newNode = children[0]->clone();
+                                       goto apply_newNode;
+                               }
+
                                int myidx = autoidx++;
                                AstNode *outreg = nullptr;