From 52c5c034954224f0ec1667523f683796cf599b6f Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Mon, 13 Feb 2012 16:25:18 +0400 Subject: [PATCH] Fixed segfault when compiling a non-constant case expression --- gen/statements.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/statements.cpp b/gen/statements.cpp index 665c6698..5a2ff209 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -887,7 +887,7 @@ void SwitchStatement::toIR(IRState* p) VarDeclaration* vd = 0; if (cs->exp->op == TOKvar) vd = ((VarExp*)cs->exp)->var->isVarDeclaration(); - if (vd && !vd->init) { + if (vd && (!vd->init || !vd->isConst())) { cs->llvmIdx = cs->exp->toElemDtor(p)->getRVal(); useSwitchInst = false; }