From 0fd7cdf72bf023ad374ea0b341ec7bb87d9cfaa5 Mon Sep 17 00:00:00 2001 From: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Date: Fri, 8 Sep 2023 22:25:27 +0800 Subject: [PATCH] Misc upstream fixes rui314/chibicc#54 rui314/chibicc#98 rui314/chibicc#118 --- codegen.c | 2 +- hashmap.c | 6 ------ main.c | 2 +- parse.c | 5 ----- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/codegen.c b/codegen.c index 8ad7099..b0817bd 100644 --- a/codegen.c +++ b/codegen.c @@ -632,7 +632,7 @@ static void copy_struct_reg(void) { if (ty->size > 8) { if (has_flonum(ty, 8, 16, 0)) { assert(ty->size == 12 || ty->size == 16); - if (ty->size == 4) + if (ty->size == 12) println(" movss 8(%%rdi), %%xmm%d", fp); else println(" movsd 8(%%rdi), %%xmm%d", fp); diff --git a/hashmap.c b/hashmap.c index c654e7c..a17d114 100644 --- a/hashmap.c +++ b/hashmap.c @@ -89,12 +89,6 @@ static HashEntry *get_or_insert_entry(HashMap *map, char *key, int keylen) { if (match(ent, key, keylen)) return ent; - if (ent->key == TOMBSTONE) { - ent->key = key; - ent->keylen = keylen; - return ent; - } - if (ent->key == NULL) { ent->key = key; ent->keylen = keylen; diff --git a/main.c b/main.c index 45cd6eb..8af5499 100644 --- a/main.c +++ b/main.c @@ -690,7 +690,7 @@ int main(int argc, char **argv) { return 0; } - if (input_paths.len > 1 && opt_o && (opt_c || opt_S | opt_E)) + if (input_paths.len > 1 && opt_o && (opt_c || opt_S || opt_E)) error("cannot specify '-o' with '-c,' '-S' or '-E' with multiple files"); StringArray ld_args = {0}; diff --git a/parse.c b/parse.c index 12b3e86..e2461c2 100644 --- a/parse.c +++ b/parse.c @@ -1098,11 +1098,6 @@ static void array_initializer1(Token **rest, Token *tok, Initializer *init) { bool first = true; - if (init->is_flexible) { - int len = count_array_init_elements(tok, init->ty); - *init = *new_initializer(array_of(init->ty->base, len), false); - } - for (int i = 0; !consume_end(rest, tok); i++) { if (!first) tok = skip(tok, ",");