M2-Planet
M2-Planet copied to clipboard
Memory leaks on compilation
Steps to reproduce
- make
-
valgrind --leak-check=full --show-leak-kinds=all ./bin/M2-Planet -f ./test/test0002/if.c
Observed behavior
valgrind reports leaks:
==1435761== Memcheck, a memory error detector
==1435761== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1435761== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==1435761== Command: ./bin/M2-Planet -f ./test/test0002/if.c
==1435761==
./test/test0002/if.c:24:putchar is not a defined symbol
==1435761==
==1435761== HEAP SUMMARY:
==1435761== in use at exit: 13,281 bytes in 363 blocks
==1435761== total heap usage: 365 allocs, 2 frees, 15,289 bytes allocated
==1435761==
==1435761== 24 bytes in 1 blocks are still reachable in loss record 1 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40ABC9: init_macro_env (cc_macro.c:48)
==1435761== by 0x40BD0B: main (cc.c:49)
==1435761==
==1435761== 34 bytes in 1 blocks are possibly lost in loss record 2 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401522: int2str (bootstrappable.c:155)
==1435761== by 0x407BAB: process_if (cc_core.c:1256)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 34 bytes in 1 blocks are definitely lost in loss record 3 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401522: int2str (bootstrappable.c:155)
==1435761== by 0x4036D6: line_error_token (cc_core.c:102)
==1435761== by 0x403715: line_error (cc_core.c:108)
==1435761== by 0x404F51: primary_expr_variable (cc_core.c:611)
==1435761== by 0x4072D4: primary_expr (cc_core.c:1142)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x406976: relational_expr (cc_core.c:1009)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x4099C8: statement (cc_core.c:1738)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 4 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40AC12: init_macro_env (cc_macro.c:51)
==1435761== by 0x40BD0B: main (cc.c:49)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 5 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4035C0: sym_declare (cc_core.c:79)
==1435761== by 0x40A604: program (cc_core.c:1938)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 6 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4035C0: sym_declare (cc_core.c:79)
==1435761== by 0x409D97: declare_function (cc_core.c:1800)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 7 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409E73: declare_function (cc_core.c:1816)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 8 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409E89: declare_function (cc_core.c:1817)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 9 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409E95: declare_function (cc_core.c:1818)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 10 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409EA1: declare_function (cc_core.c:1819)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 11 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409EB7: declare_function (cc_core.c:1820)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 12 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x409EC3: declare_function (cc_core.c:1821)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 13 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x407BD0: process_if (cc_core.c:1259)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 14 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403529: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407BED: process_if (cc_core.c:1260)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 15 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403538: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407BED: process_if (cc_core.c:1260)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 16 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x40354A: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407BED: process_if (cc_core.c:1260)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 17 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403559: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407BED: process_if (cc_core.c:1260)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 18 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404CC4: primary_expr_number (cc_core.c:538)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x406976: relational_expr (cc_core.c:1009)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 19 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404CDA: primary_expr_number (cc_core.c:539)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x406976: relational_expr (cc_core.c:1009)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 20 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404DEE: primary_expr_number (cc_core.c:568)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x406976: relational_expr (cc_core.c:1009)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 21 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x405119: common_recursion (cc_core.c:641)
==1435761== by 0x405381: arithmetic_recursion (cc_core.c:676)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 22 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404CC4: primary_expr_number (cc_core.c:538)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x4051DA: common_recursion (cc_core.c:650)
==1435761== by 0x405381: arithmetic_recursion (cc_core.c:676)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 23 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404CDA: primary_expr_number (cc_core.c:539)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x4051DA: common_recursion (cc_core.c:650)
==1435761== by 0x405381: arithmetic_recursion (cc_core.c:676)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 24 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x404DEE: primary_expr_number (cc_core.c:568)
==1435761== by 0x407306: primary_expr (cc_core.c:1143)
==1435761== by 0x405CE2: postfix_expr (cc_core.c:872)
==1435761== by 0x4063AD: additive_expr (cc_core.c:944)
==1435761== by 0x4051DA: common_recursion (cc_core.c:650)
==1435761== by 0x405381: arithmetic_recursion (cc_core.c:676)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 25 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x405224: common_recursion (cc_core.c:653)
==1435761== by 0x405381: arithmetic_recursion (cc_core.c:676)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 26 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x4053BB: arithmetic_recursion (cc_core.c:683)
==1435761== by 0x4064C3: relational_expr_stub (cc_core.c:966)
==1435761== by 0x406980: relational_expr (cc_core.c:1010)
==1435761== by 0x406DE2: bitwise_expr (cc_core.c:1069)
==1435761== by 0x407329: expression (cc_core.c:1149)
==1435761== by 0x407C21: process_if (cc_core.c:1264)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 27 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x4034F5: emit_out (cc_core.c:63)
==1435761== by 0x407C48: process_if (cc_core.c:1266)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 28 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403529: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407CD5: process_if (cc_core.c:1272)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 29 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403538: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407CD5: process_if (cc_core.c:1272)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 30 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x40354A: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407CD5: process_if (cc_core.c:1272)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 40 bytes in 1 blocks are still reachable in loss record 31 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x403496: emit (cc_core.c:54)
==1435761== by 0x403559: uniqueID (cc_core.c:68)
==1435761== by 0x403590: uniqueID_out (cc_core.c:74)
==1435761== by 0x407CD5: process_if (cc_core.c:1272)
==1435761== by 0x4096F7: statement (cc_core.c:1690)
==1435761== by 0x4093A8: recursive_statement (cc_core.c:1623)
==1435761== by 0x40961C: statement (cc_core.c:1675)
==1435761== by 0x409ECD: declare_function (cc_core.c:1822)
==1435761== by 0x40A708: program (cc_core.c:1949)
==1435761== by 0x40C6D5: main (cc.c:207)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 32 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x402747: initialize_types (cc_types.c:78)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 33 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x402747: initialize_types (cc_types.c:78)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 34 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x402747: initialize_types (cc_types.c:78)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 35 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x40278C: initialize_types (cc_types.c:82)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 36 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x40278C: initialize_types (cc_types.c:82)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 37 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x40278C: initialize_types (cc_types.c:82)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 38 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x4027D1: initialize_types (cc_types.c:86)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 39 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x4027D1: initialize_types (cc_types.c:86)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 40 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x4027D1: initialize_types (cc_types.c:86)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 41 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x402816: initialize_types (cc_types.c:90)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 42 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x402816: initialize_types (cc_types.c:90)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 43 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x402816: initialize_types (cc_types.c:90)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 44 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x40285B: initialize_types (cc_types.c:94)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 45 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x40285B: initialize_types (cc_types.c:94)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 46 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x40285B: initialize_types (cc_types.c:94)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 47 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x4028A6: initialize_types (cc_types.c:98)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 48 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x4028A6: initialize_types (cc_types.c:98)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 49 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x4028A6: initialize_types (cc_types.c:98)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 50 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x4025AD: new_primitive (cc_types.c:43)
==1435761== by 0x4028EB: initialize_types (cc_types.c:102)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 51 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40260B: new_primitive (cc_types.c:51)
==1435761== by 0x4028EB: initialize_types (cc_types.c:102)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 56 bytes in 1 blocks are still reachable in loss record 52 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x402681: new_primitive (cc_types.c:60)
==1435761== by 0x4028EB: initialize_types (cc_types.c:102)
==1435761== by 0x40C6B3: main (cc.c:204)
==1435761==
==1435761== 173 bytes in 50 blocks are indirectly lost in loss record 53 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401C3E: get_token (cc_reader.c:282)
==1435761== by 0x401D8F: read_all_tokens (cc_reader.c:315)
==1435761== by 0x40BEB2: main (cc.c:79)
==1435761==
==1435761== 424 bytes in 105 blocks are still reachable in loss record 54 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401C3E: get_token (cc_reader.c:282)
==1435761== by 0x401D8F: read_all_tokens (cc_reader.c:315)
==1435761== by 0x40BEB2: main (cc.c:79)
==1435761==
==1435761== 680 bytes in 17 blocks are indirectly lost in loss record 55 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401A33: get_token (cc_reader.c:213)
==1435761== by 0x401D8F: read_all_tokens (cc_reader.c:315)
==1435761== by 0x40BEB2: main (cc.c:79)
==1435761==
==1435761== 2,173 (1,320 direct, 853 indirect) bytes in 33 blocks are definitely lost in loss record 56 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401A33: get_token (cc_reader.c:213)
==1435761== by 0x401D8F: read_all_tokens (cc_reader.c:315)
==1435761== by 0x40BEB2: main (cc.c:79)
==1435761==
==1435761== 4,096 bytes in 1 blocks are still reachable in loss record 57 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x40BDC2: main (cc.c:66)
==1435761==
==1435761== 4,200 bytes in 105 blocks are still reachable in loss record 58 of 58
==1435761== at 0x483A971: calloc (in /nix/store/55pdc6agvsq5347kcswdd5giyi8m0ny2-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1435761== by 0x401A33: get_token (cc_reader.c:213)
==1435761== by 0x401D8F: read_all_tokens (cc_reader.c:315)
==1435761== by 0x40BEB2: main (cc.c:79)
==1435761==
==1435761== LEAK SUMMARY:
==1435761== definitely lost: 1,354 bytes in 34 blocks
==1435761== indirectly lost: 853 bytes in 67 blocks
==1435761== possibly lost: 34 bytes in 1 blocks
==1435761== still reachable: 11,040 bytes in 261 blocks
==1435761== suppressed: 0 bytes in 0 blocks
==1435761==
==1435761== For lists of detected and suppressed errors, rerun with: -s
==1435761== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Am i missing some flag, that needed to correctly compile M2-Planet so it doesn't leak allocated memory?
In general stage0 stuff and M2-Planet did not really try to free any memory and either relied on kernel to clean it up after the process exists or in case of stage0-uefi we are doing cleanup on exit in the C library. Right now free()
function in M2libc just does return 0
though I might add some memory manager and implement non-dummy free()
.