shecc
shecc copied to clipboard
Unable to bootstrap when "init_val != 0" is reduced into "init_val"
Reproducible with the following change:
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -77,7 +77,7 @@ void size_funcs(int data_start)
data_start + elf_data_idx);
/* TODO: add .bss section */
if (strcmp(blk->locals[i].type_name, "int") == 0 &&
- blk->locals[i].init_val != 0)
+ blk->locals[i].init_val)
elf_write_data_int(blk->locals[i].init_val);
else
elf_data_idx += size_var(&blk->locals[i]);
Stage 2 of the bootstrapping would fail.