From 4b94aa3377a837f5fe9dd91b6d238d149d6bbaf5 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Sat, 31 May 2014 09:16:28 +1000 Subject: [PATCH] Fix Issue 12824 - REG(2.066) ICE(statement.c) Segfault with label and static if --- src/statement.c | 6 ++++++ test/runnable/xtest46.d | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/statement.c b/src/statement.c index 62b9d31353d6..f6dfd249ba03 100644 --- a/src/statement.c +++ b/src/statement.c @@ -4916,6 +4916,12 @@ Statement *LabelStatement::scopeCode(Scope *sc, Statement **sentry, Statement ** //printf("LabelStatement::scopeCode()\n"); if (statement) statement = statement->scopeCode(sc, sentry, sexit, sfinally); + else + { + *sentry = NULL; + *sexit = NULL; + *sfinally = NULL; + } return this; } diff --git a/test/runnable/xtest46.d b/test/runnable/xtest46.d index 725ad2b96c69..138f9fd1b013 100644 --- a/test/runnable/xtest46.d +++ b/test/runnable/xtest46.d @@ -6740,6 +6740,16 @@ void test10091() auto arr = cast(ubyte[1]) S10091.e; } +/***************************************************/ + +void test12824() +{ +label: + static if (0) + { + } +} + /***************************************************/ // 9130 @@ -7179,6 +7189,7 @@ int main() test8064(); test8105(); test159(); + test12824(); test8283(); test8395(); test5749();