shecc icon indicating copy to clipboard operation
shecc copied to clipboard

Unable to bootstrap when "init_val != 0" is reduced into "init_val"

Open jserv opened this issue 4 years ago • 0 comments

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.

jserv avatar Nov 08 '20 14:11 jserv