From: Dale Weiler Date: Mon, 7 Jan 2013 12:40:03 +0000 (+0000) Subject: Merge branch 'master' of github.com:graphitemaster/gmqcc X-Git-Tag: before-library~353 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=54c8801becfc2e0bc4cf965c1d62e6d75a262fe2;hp=d8ae1cb3e9049fa415339db6948095d5d3601de2 Merge branch 'master' of github.com:graphitemaster/gmqcc --- diff --git a/Makefile b/Makefile index 876bdd9..52e7270 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ CYGWIN = $(findstring CYGWIN, $(UNAME)) MINGW = $(findstring MINGW32, $(UNAME)) CC ?= clang -CFLAGS += -Wall -Wextra -I. -fno-strict-aliasing -fsigned-char -O2 +CFLAGS += -Wall -Wextra -I. -fno-strict-aliasing -fsigned-char CFLAGS += -DGMQCC_GITINFO="`git describe`" #turn on tons of warnings if clang is present # but also turn off the STUPID ONES diff --git a/ir.c b/ir.c index afe4a40..6ac74e8 100644 --- a/ir.c +++ b/ir.c @@ -2884,7 +2884,7 @@ tailcall: if (onfalse->generated) { /* fixup the jump address */ code_statements[stidx].o2.s1 = (onfalse->code_start) - (stidx); - if (code_statements[stidx].o2.s1 == 1) { + if (stidx+2 == vec_size(code_statements) && code_statements[stidx].o2.s1 == 1) { code_statements[stidx] = code_statements[stidx+1]; if (code_statements[stidx].o1.s1 < 0) code_statements[stidx].o1.s1++; @@ -2909,7 +2909,7 @@ tailcall: code_push_statement(&stmt, instr->context.line); return true; } - else if (code_statements[stidx].o2.s1 == 1) { + else if (stidx+2 == vec_size(code_statements) && code_statements[stidx].o2.s1 == 1) { code_statements[stidx] = code_statements[stidx+1]; if (code_statements[stidx].o1.s1 < 0) code_statements[stidx].o1.s1++; diff --git a/opts.def b/opts.def index 22e2dab..3c83420 100644 --- a/opts.def +++ b/opts.def @@ -91,7 +91,7 @@ #ifdef GMQCC_TYPE_OPTIMIZATIONS GMQCC_DEFINE_FLAG(PEEPHOLE, 1) - GMQCC_DEFINE_FLAG(LOCAL_TEMPS, 3) + GMQCC_DEFINE_FLAG(LOCAL_TEMPS, 4) GMQCC_DEFINE_FLAG(GLOBAL_TEMPS, 3) GMQCC_DEFINE_FLAG(TAIL_RECURSION, 1) GMQCC_DEFINE_FLAG(TAIL_CALLS, 2) diff --git a/parser.c b/parser.c index aa3c38e..d374af7 100644 --- a/parser.c +++ b/parser.c @@ -2165,6 +2165,8 @@ static bool parse_if(parser_t *parser, ast_block *block, ast_expression **out) ast_delete(cond); return false; } + if (!ontrue) + ontrue = (ast_expression*)ast_block_new(parser_ctx(parser)); /* check for an else */ if (!strcmp(parser_tokval(parser), "else")) { /* parse into the 'else' branch */