c-semantics
c-semantics copied to clipboard
kcc cannot compile code with long array
I tried to compile google/brotli project with kcc. The following error occurred during compilation:
Fatal error: exception Stack overflow
I minimized this error:
// main.c
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
uint8_t Data[] = {
116,105,109,101,100.........
}; /* length: 122784 */
int length = sizeof(Data)/sizeof(uint8_t);
printf("length: %d\n", length);
}
compile with gcc:
kcc -d -c main.c
Gives the following error:
DEBUG> Executing: (command -v rv-error || true) 1>/home/file_path/.tmp-kcc-mOF4K/shell-fzMi0
DEBUG> (Result: 0)
DEBUG> Preprocessing main.c.
DEBUG> Executing: g++ -std=c++14 -E /dev/null
g++: warning: /dev/null: linker input file unused because linking not done
DEBUG> (Result: 0)
DEBUG> Executing: gcc -std=c11 -E /dev/null
gcc: warning: /dev/null: linker input file unused because linking not done
DEBUG> (Result: 0)
DEBUG> Executing: /opt/rv-match/c-semantics/profiles/x86_64-linux-gcc-glibc/pp -pedantic '-std=c11' main.c -o /home/file_path/.tmp-kcc-mOF4K/pp-uo6uB
DEBUG> (Result: 0)
DEBUG> Executing: touch /home/file_path/.tmp-kcc-mOF4K/trampolines-_5eoI
DEBUG> (Result: 0)
DEBUG> Executing: rv-ifdefclear /home/file_path/.tmp-kcc-mOF4K/pp-uo6uB || true
DEBUG> (Result: 0)
DEBUG> Parsing main.c.
DEBUG> Executing: (/opt/rv-match/c-semantics/cparser /home/file_path/.tmp-kcc-mOF4K/pp-uo6uB --trueName mainlong.c) 1>/home/file_path/.tmp-kcc-mOF4K/kast-txt-Lo6SW
Fatal error: exception Stack overflow
Raised by primitive operation at file "buffer.ml", line 27, characters 9-23
Called from file "list.ml", line 81, characters 12-17
Called from file "list.ml", line 81, characters 12-17
Called from file "list.ml", line 81, characters 12-17
Called from file "list.ml", line 81, characters 12-17
......
Called from file "list.ml", line 81, characters 12-17
Called from file "list.ml", line 81, characters 12-17
DEBUG> (Result: 2)
Translation failed (kcc_config dumped). Refer to last command run for details.