Konstantin8105 / c4go

Transpiling C code to Go code
MIT License
363 stars 37 forks source link

Transpiling modified lua5.1 #387

Closed zaoqi closed 3 years ago

zaoqi commented 5 years ago

https://gitlab.com/the-language/the-language/tree/7ade276ad241c7fdff0163cf41295e03e869e7a5/core/arch/c/lang.c

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x6e2d89, 0xe)
    /home/1828_sandbox/pkgs/go/src/runtime/panic.go:617 +0x72
runtime.newstack()
    /home/1828_sandbox/pkgs/go/src/runtime/stack.go:1041 +0x6f0
runtime.morestack()
    /home/1828_sandbox/pkgs/go/src/runtime/asm_amd64.s:429 +0x8f

goroutine 1 [running]:
strings.Replace(0xc0023a5da0, 0x52, 0x6dc600, 0x3, 0x6dc485, 0x2, 0xffffffffffffffff, 0xc0023a5da7, 0x4a)
    /home/1828_sandbox/pkgs/go/src/strings/strings.go:848 +0x555 fp=0xc02c000370 sp=0xc02c000368 pc=0x4d51a5
github.com/Konstantin8105/c4go/util.CleanCType(0xc0023a5da0, 0x52, 0x6e074f, 0x9)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/util/util.go:320 +0x83 fp=0xc02c000590 sp=0xc02c000370 pc=0x549c13
github.com/Konstantin8105/c4go/util.GenerateCorrectType(0xc0023a5da0, 0x52, 0xc0023a5da0, 0x52)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/util/util.go:388 +0x69b fp=0xc02c0006f8 sp=0xc02c000590 pc=0x54ad6b
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:51 +0x264 fp=0xc02c000950 sp=0xc02c0006f8 pc=0x5baed4
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c000ba8 sp=0xc02c000950 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c000e00 sp=0xc02c000ba8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c001058 sp=0xc02c000e00 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c0012b0 sp=0xc02c001058 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c001508 sp=0xc02c0012b0 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c001760 sp=0xc02c001508 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c0019b8 sp=0xc02c001760 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c001c10 sp=0xc02c0019b8 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c001e68 sp=0xc02c001c10 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0001a7140, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c0020c0 sp=0xc02c001e68 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:115 +0x9ac fp=0xc02c002318 sp=0xc02c0020c0 pc=0x5bb61c
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c002570 sp=0xc02c002318 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c0027c8 sp=0xc02c002570 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c002a20 sp=0xc02c0027c8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c002c78 sp=0xc02c002a20 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c002ed0 sp=0xc02c002c78 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c003128 sp=0xc02c002ed0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c003380 sp=0xc02c003128 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c0035d8 sp=0xc02c003380 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c003830 sp=0xc02c0035d8 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c003a88 sp=0xc02c003830 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c003ce0 sp=0xc02c003a88 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c003f38 sp=0xc02c003ce0 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c004190 sp=0xc02c003f38 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c0043e8 sp=0xc02c004190 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c004640 sp=0xc02c0043e8 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c004898 sp=0xc02c004640 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c004af0 sp=0xc02c004898 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c004d48 sp=0xc02c004af0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c004fa0 sp=0xc02c004d48 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c0051f8 sp=0xc02c004fa0 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c005450 sp=0xc02c0051f8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c0056a8 sp=0xc02c005450 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c005900 sp=0xc02c0056a8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c005b58 sp=0xc02c005900 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c005db0 sp=0xc02c005b58 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c006008 sp=0xc02c005db0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c006260 sp=0xc02c006008 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c0064b8 sp=0xc02c006260 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c006710 sp=0xc02c0064b8 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c006968 sp=0xc02c006710 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c006bc0 sp=0xc02c006968 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c006e18 sp=0xc02c006bc0 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c007070 sp=0xc02c006e18 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c0072c8 sp=0xc02c007070 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c007520 sp=0xc02c0072c8 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c007778 sp=0xc02c007520 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c0079d0 sp=0xc02c007778 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c007c28 sp=0xc02c0079d0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0001a7140, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c007e80 sp=0xc02c007c28 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:115 +0x9ac fp=0xc02c0080d8 sp=0xc02c007e80 pc=0x5bb61c
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c008330 sp=0xc02c0080d8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c008588 sp=0xc02c008330 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c0087e0 sp=0xc02c008588 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c008a38 sp=0xc02c0087e0 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c008c90 sp=0xc02c008a38 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c008ee8 sp=0xc02c008c90 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c009140 sp=0xc02c008ee8 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c009398 sp=0xc02c009140 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c0095f0 sp=0xc02c009398 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c009848 sp=0xc02c0095f0 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c009aa0 sp=0xc02c009848 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c009cf8 sp=0xc02c009aa0 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c009f50 sp=0xc02c009cf8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00a1a8 sp=0xc02c009f50 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00a400 sp=0xc02c00a1a8 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00a658 sp=0xc02c00a400 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00a8b0 sp=0xc02c00a658 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00ab08 sp=0xc02c00a8b0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00ad60 sp=0xc02c00ab08 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00afb8 sp=0xc02c00ad60 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00b210 sp=0xc02c00afb8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00b468 sp=0xc02c00b210 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00b6c0 sp=0xc02c00b468 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00b918 sp=0xc02c00b6c0 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00bb70 sp=0xc02c00b918 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00bdc8 sp=0xc02c00bb70 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00c020 sp=0xc02c00bdc8 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00c278 sp=0xc02c00c020 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00c4d0 sp=0xc02c00c278 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00c728 sp=0xc02c00c4d0 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00c980 sp=0xc02c00c728 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00cbd8 sp=0xc02c00c980 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00ce30 sp=0xc02c00cbd8 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0001a7140, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00d088 sp=0xc02c00ce30 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:115 +0x9ac fp=0xc02c00d2e0 sp=0xc02c00d088 pc=0x5bb61c
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00d538 sp=0xc02c00d2e0 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00d790 sp=0xc02c00d538 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00d9e8 sp=0xc02c00d790 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00dc40 sp=0xc02c00d9e8 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00de98 sp=0xc02c00dc40 pc=0x5bb6a1
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc00391429d, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00e0f0 sp=0xc02c00de98 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003914301, 0xb, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:70 +0x55b fp=0xc02c00e348 sp=0xc02c00e0f0 pc=0x5bb1cb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc003913ebb, 0x4, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:40 +0x217b fp=0xc02c00e5a0 sp=0xc02c00e348 pc=0x5bcdeb
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0023a5da0, 0x52, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:73 +0x5cd fp=0xc02c00e7f8 sp=0xc02c00e5a0 pc=0x5bb23d
github.com/Konstantin8105/c4go/types.SizeOf(0xc0001bc160, 0xc0039140d7, 0xa, 0x0, 0x0, 0x0)
    /home/1828_sandbox/src/the-language/core/arch/go/deps/src/github.com/Konstantin8105/c4go/types/sizeof.go:118 +0xa31 fp=0xc02c00ea50 sp=0xc02c00e7f8 pc=0x5bb6a1
...additional frames elided...
Konstantin8105 commented 5 years ago

Hello, could clarify your command line for repeat that error?

zaoqi commented 5 years ago

https://gitlab.com/the-language/the-language/tree/7ade276ad241c7fdff0163cf41295e03e869e7a5/core/arch/c/lang.c

c4go transpile lang.c

Konstantin8105 commented 5 years ago

Thank you for issue. I create a PR for solving the problem and after few minutes, I will merge in master branch. Results:

Calculate warnings in file: ./testdata/lang/lang.go
        After transpiling : 314 warnings.
        Go build : 2 warnings
        Unsafe   : 1029

After merging, try next and choose with minimal warnings:

c4go transpile lang.c
c4go transpile -s lang.c
zaoqi commented 5 years ago

https://gitlab.com/the-language/the-language/blob/7ade276ad241c7fdff0163cf41295e03e869e7a5/core/arch/c/testmain.c

$ gcc lang.c testmain.c -lm &&./a.out ... #(符名 太始初核 (一類何物 (式形 (化滅 省略一物 化滅)) 特定其物)) $ c4go transpile -s lang.c testmain.c $ go run lang.go

# command-line-arguments
./lang.go:48279:27: could not determine kind of name for C.__jmp_buf_tag
Konstantin8105 commented 5 years ago

Yes, C.__jmp_buf_tag from C header setjmp.h is not implemented and it is cannot be implemented because Go language cannot jump from middle function to middle another function and back.

zaoqi commented 5 years ago

Lua 5.1:

/*
@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
** CHANGE them if you prefer to use longjmp/setjmp even with C++
** or if want/don't to use _longjmp/_setjmp instead of regular
** longjmp/setjmp. By default, Lua handles errors with exceptions when
** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
** and with longjmp/setjmp otherwise.
*/
#if defined(__cplusplus)
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) try { a } catch(...) \
    { if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int  /* dummy variable */

#elif defined(LUA_USE_ULONGJMP)
/* in Unix, try _longjmp/_setjmp (more efficient) */
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf

#else
/* default handling with long jumps */
#define LUAI_THROW(L,c) longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf

#endif
zaoqi commented 5 years ago

Maybe defer, panic, recover can handle this situation

Konstantin8105 commented 5 years ago

Maybe, that jumps is not clear for my self. You can help with that : Create solution in PR or create some example on C and Go or ...

zaoqi commented 5 years ago

throw

panic(...)

catch

defer func() {
    if e := recover(); e != nil {
        //...
    }
}()

Maybe add some non-standard extensions or C++'s try and catch can solve this problem.

Konstantin8105 commented 5 years ago

Yes, I understood your approach. For myself - is not clear - how to implemented on real example http://www.c-cpp.ru/content/setjmp?

zaoqi-unsafe commented 5 years ago
zaoqi-unsafe commented 5 years ago

https://stackoverflow.com/questions/1713907/is-it-possible-to-do-a-call-cc-in-go http://www.inf.puc-rio.br/~roberto/docs/MCC15-04.pdf

Goroutines are equivalent to one-shot continuations.

Maybe setjmp can be implemented with Goroutines.

Konstantin8105 commented 5 years ago

Dear @zaoqi-unsafe, Could you prepare example of transpilation for understood your approach? Example of C code : http://www.c-cpp.ru/content/setjmp

Konstantin8105 commented 5 years ago

Dear @zaoqi, In my point of view - main transpilation problem for LUA project is not enough C code - some base struct is not in file lang.c. Could you approve?

zaoqi-unsafe commented 5 years ago

@Konstantin8105 $ gcc lang.c testmain.c -lm &&./a.out

What base struct?math.h?jmp_buf?

zaoqi-unsafe commented 5 years ago

https://en.cppreference.com/w/c/program/longjmp If ignore undefined behavior, setjmp, longjmp and try, catch is equivalent

zaoqi-unsafe commented 5 years ago

Then how to implement setjmp, longjmp is obvious.

choleraehyq commented 4 years ago

@zaoqi-unsafe Don't know your meaning. Recover only make sense in defer, which means you cannot resume to the correct place. Can you show an equivalent go example to http://www.c-cpp.ru/content/setjmp this code?

#include <stdio.h>
#include <setjmp.h>

jmp_buf ebuf;
void f2 (void);

int main(void)
{
char first=1;
int i;
printf("1 ");
i = setjmp(ebuf);
if (first) {
first =! first;
f2();
printf ("this will not be printed");
}
printf("%d", i);
return 0;
}

void f2(void)
{
printf("2 ");
longjmp(ebuf, 3);
}

If you use defer+recover as setjmp, panic as longjmp, the main function will exit right after you recover the panic, but the C example will continue to run. Don't know if I misunderstand something.