When compiles the attached c0.c, cc0 will crash:
$ cc0 c0.c -o c0.bin temp file is: c0.c.tmp Segmentation fault (core dumped)
The backtrace when cc0 crashes:
(gdb) r c0.c -o c0.bin Starting program: /home/zma/cc0/cc0-code/src/toolchain/build/tools/cc0/cc0 c0.c -o c0.bin temp file is: c0.c.tmp Detaching after fork from child process 34504. Program received signal SIGSEGV, Segmentation fault. 0x000000000055bbc0 in memmove () (gdb) bt #0 0x000000000055bbc0 in memmove () #1 0x00000000004c6874 in newPtr8 () #2 0x00000000004c442e in antlr38BitSubstr () #3 0x00000000004ca659 in getText () #4 0x0000000000445037 in declaration_specifiers (ctx=0x842db0) at /home/zma/cc0/cc0-code/src/toolchain/build/frontend/c/CParser.cpp:5795 #5 0x0000000000443a31 in function_definition (ctx=0x842db0) at /home/zma/cc0/cc0-code/src/toolchain/build/frontend/c/CParser.cpp:5142 #6 0x000000000046293f in synpred1_C_fragment (ctx=0x842db0) at /home/zma/cc0/cc0-code/src/toolchain/build/frontend/c/CParser.cpp:22964 #7 0x0000000000464ea3 in synpred1_C (ctx=0x842db0) at /home/zma/cc0/cc0-code/src/toolchain/build/frontend/c/CParser.cpp:24291 #8 0x00000000004429be in translation_unit (ctx=0x842db0) at /home/zma/cc0/cc0-code/src/toolchain/build/frontend/c/CParser.cpp:4690 #9 0x0000000000433e4c in CSourceParser::Parse (this=0x8419e0, fileName=...) at /home/zma/cc0/cc0-code/src/toolchain/frontend/c/CSourceParser.cpp:59 #10 0x0000000000400cb8 in main (argc=4, argv=0x7fffffffe2b8) at /home/zma/cc0/cc0-code/src/toolchain/tools/cc0/main.cpp:170
However, after deleting one or more lines from the source file, cc0 can successfully compile it.
It turns out to be the problem of g++ which compiles the cc0. With a
newer version of g++ (4.8.2), the built cc0 can compile large (100,000
lines at least) source.