gotranspile / cxgo

Tool for transpiling C to Go.
https://gotranspile.dev
MIT License
337 stars 22 forks source link

go test potrace-go fail #52

Closed jilieryuyi closed 1 year ago

jilieryuyi commented 2 years ago

go version v1.17

image

jilieryuyi commented 2 years ago

after fix and run

API server listening at: [::]:10959
=== RUN   TestPotrace
runtime: unexpected return pc for gotrace.findpath called from 0x1a
stack: frame={sp:0xc00006b5e0, fp:0xc00006b750} stack=[0xc000068000,0xc00006c000)
0x000000c00006b4e0:  0x0000000000000008  0x000000c00006ba10 
0x000000c00006b4f0:  0x0000000000000000  0x0000000000c0dc9e <runtime.nextFreeFast+0x000000000000009e> 
0x000000c00006b500:  0x0000000000c2819f <runtime.makeSpanClass+0x000000000000001f>  0x0000000000000001 
0x000000c00006b510:  0x000000c00014e1c0  0x000000c00014e1a0 
0x000000c00006b520:  0x0000000000000000  0x0000000000f92de0 
0x000000c00006b530:  0x00000000011bcf20  0x0000000000000000 
0x000000c00006b540:  0x0000000000000000  0x0000000000000000 
0x000000c00006b550:  0x0000000000000000  0x000000c00006b578 
0x000000c00006b560:  0x0000000000c3a4c5 <runtime.panicmem+0x0000000000000045>  0x0000000000f92de0 
0x000000c00006b570:  0x00000000011bcf20  0x000000c00006b5a8 
0x000000c00006b580:  0x0000000000c51271 <runtime.sigpanic+0x00000000000000d1>  0x000000c00014e1a0 
0x000000c00006b590:  0x0000027bb6df3e8b  0x000000c00006b5d0 
0x000000c00006b5a0:  0x000000c00014e1a0  0x000000c00006b5d0 
0x000000c00006b5b0:  0x0000000000f570c9 <gotrace.findpath.func2+0x0000000000000069>  0x0000000000c0e501 <runtime.mallocgc+0x00000000000005e1> 
0x000000c00006b5c0:  0x0000027bb6d9a208  0x0001000000000000 
0x000000c00006b5d0:  0x000000c00006b740  0x0000000000f56af5 <gotrace.findpath+0x00000000000004d5> 
0x000000c00006b5e0: <0x000000c00006b620  0x000000c00006b648 
0x000000c00006b5f0:  0x000000c00006b640  0x000000000000008a 
0x000000c00006b600:  0x000000c00006b618  0x0000000000000030 
0x000000c00006b610:  0x0000000100001300  0x000000000000008a 
0x000000c00006b620:  0x0000000000000019  0x0000000000000000 
0x000000c00006b630:  0x0000000000000082  0x0000000000000009 
0x000000c00006b640:  0x0000000000000000  0xffffffffffffffff 
0x000000c00006b650:  0x0000000000000001  0x0000000000000001 
0x000000c00006b660:  0xffffffffffffff5e  0x0000000000000000 
0x000000c00006b670:  0x0000000000000000  0x000000c0001611e0 
0x000000c00006b680:  0x0000000000000000  0x0000000000000000 
0x000000c00006b690:  0x000000c00006b748  0x000000c00006b748 
0x000000c00006b6a0:  0x0000000000000020  0x000000c0001624e0 
0x000000c00006b6b0:  0x000000c000122900  0x0000000000000082 
0x000000c00006b6c0:  0x0000000000000082  0x000000000000001c 
0x000000c00006b6d0:  0x0000000000000090  0x000000000000001c 
0x000000c00006b6e0:  0x000000000000008f  0x000000000000001c 
0x000000c00006b6f0:  0x000000000000008e  0x000000000000001b 
0x000000c00006b700:  0x000000000000008e  0x000000000000001b 
0x000000c00006b710:  0x000000000000008d  0x000000000000001b 
0x000000c00006b720:  0x000000000000008c  0x000000000000001a 
0x000000c00006b730:  0x000000000000008c  0x000000000000001a 
0x000000c00006b740:  0x000000000000008b !0x000000000000001a 
0x000000c00006b750: >0x000000000000008a  0x000000000000001c 
0x000000c00006b760:  0x0000000000000090  0x000000000000002b 
0x000000c00006b770:  0x0000000000000004  0x0100000000000018 
0x000000c00006b780:  0x0000000000000000  0x000000000000008f 
0x000000c00006b790:  0x000000000000001c  0x000000000000002b 
0x000000c00006b7a0:  0x0000000000000018  0x0000000000000004 
0x000000c00006b7b0:  0x0000000000000000  0x000000c00006b7c0 
0x000000c00006b7c0:  0x0000000000000000  0x0000000000000000 
0x000000c00006b7d0:  0x000000c00007d170  0x0000000000000000 
0x000000c00006b7e0:  0x000000c00006b898  0x000000c00006b810 
0x000000c00006b7f0:  0x0000000000c0e787 <runtime.newobject+0x0000000000000027>  0x0100000000000018 
0x000000c00006b800:  0x0000000000000000  0x0000000000000000 
0x000000c00006b810:  0x000000c00006b8d0  0x0000000000f58bcd <gotrace.Trace+0x000000000000018d> 
0x000000c00006b820:  0x000000c00007d140  0x000000c00006b858 
0x000000c00006b830:  0x000000c00005c1e0  0x000000c00006b860 
0x000000c00006b840:  0x0000000000000000  0x0000000000000000 
fatal error: unknown caller pc

runtime stack:
runtime.throw({0xfd7a79, 0x117ee60})
    C:/Program Files/Go/src/runtime/panic.go:1198 +0x76
runtime.gentraceback(0xc3a4c5, 0xc00006b568, 0xc0a40f, 0xc00014e1a0, 0x0, 0x0, 0x7fffffff, 0xa6dbfffce0, 0x5b00000000000001, 0x0)
    C:/Program Files/Go/src/runtime/traceback.go:274 +0x1819
runtime.addOneOpenDeferFrame.func1()
    C:/Program Files/Go/src/runtime/panic.go:751 +0x6b
runtime.systemstack()
    C:/Program Files/Go/src/runtime/asm_amd64.s:383 +0x4e

goroutine 6 [running]:
runtime.systemstack_switch()
    C:/Program Files/Go/src/runtime/asm_amd64.s:350 fp=0xc00006b468 sp=0xc00006b460 pc=0xc6b3c0
runtime.addOneOpenDeferFrame(0x0, 0x0, 0x203000000000002)
    C:/Program Files/Go/src/runtime/panic.go:750 +0x77 fp=0xc00006b4a8 sp=0xc00006b468 pc=0xc3b8d7
panic({0xf92de0, 0x11bcf20})
    C:/Program Files/Go/src/runtime/panic.go:998 +0x11a fp=0xc00006b568 sp=0xc00006b4a8 pc=0xc3c1da
runtime.panicmem()
    C:/Program Files/Go/src/runtime/panic.go:221 +0x45 fp=0xc00006b588 sp=0xc00006b568 pc=0xc3a4c5
runtime.sigpanic()
    C:/Program Files/Go/src/runtime/signal_windows.go:254 +0xd1 fp=0xc00006b5b8 sp=0xc00006b588 pc=0xc51271
gotrace.findpath.func2(0xc00006b620, 0xc00006b648, 0xc00006b640, 0x8a, 0xc00006b618)
    D:/code/cxgo-main/.examples/potrace-go/decompose.go:229 +0x69 fp=0xc00006b5e0 sp=0xc00006b5b8 pc=0xf570c9
runtime: unexpected return pc for gotrace.findpath called from 0x1a
stack: frame={sp:0xc00006b5e0, fp:0xc00006b750} stack=[0xc000068000,0xc00006c000)
0x000000c00006b4e0:  0x0000000000000008  0x000000c00006ba10 
0x000000c00006b4f0:  0x0000000000000000  0x0000000000c0dc9e <runtime.nextFreeFast+0x000000000000009e> 
0x000000c00006b500:  0x0000000000c2819f <runtime.makeSpanClass+0x000000000000001f>  0x0000000000000001 
0x000000c00006b510:  0x000000c00014e1c0  0x000000c00014e1a0 
0x000000c00006b520:  0x0000000000000000  0x0000000000f92de0 
0x000000c00006b530:  0x00000000011bcf20  0x0000000000000000 
0x000000c00006b540:  0x0000000000000000  0x0000000000000000 
0x000000c00006b550:  0x0000000000000000  0x000000c00006b578 
0x000000c00006b560:  0x0000000000c3a4c5 <runtime.panicmem+0x0000000000000045>  0x0000000000f92de0 
0x000000c00006b570:  0x00000000011bcf20  0x000000c00006b5a8 
0x000000c00006b580:  0x0000000000c51271 <runtime.sigpanic+0x00000000000000d1>  0x000000c00014e1a0 
0x000000c00006b590:  0x0000027bb6df3e8b  0x000000c00006b5d0 
0x000000c00006b5a0:  0x000000c00014e1a0  0x000000c00006b5d0 
0x000000c00006b5b0:  0x0000000000f570c9 <gotrace.findpath.func2+0x0000000000000069>  0x0000000000c0e501 <runtime.mallocgc+0x00000000000005e1> 
0x000000c00006b5c0:  0x0000027bb6d9a208  0x0001000000000000 
0x000000c00006b5d0:  0x000000c00006b740  0x0000000000f56af5 <gotrace.findpath+0x00000000000004d5> 
0x000000c00006b5e0: <0x000000c00006b620  0x000000c00006b648 
0x000000c00006b5f0:  0x000000c00006b640  0x000000000000008a 
0x000000c00006b600:  0x000000c00006b618  0x0000000000000030 
0x000000c00006b610:  0x0000000100001300  0x000000000000008a 
0x000000c00006b620:  0x0000000000000019  0x0000000000000000 
0x000000c00006b630:  0x0000000000000082  0x0000000000000009 
0x000000c00006b640:  0x0000000000000000  0xffffffffffffffff 
0x000000c00006b650:  0x0000000000000001  0x0000000000000001 
0x000000c00006b660:  0xffffffffffffff5e  0x0000000000000000 
0x000000c00006b670:  0x0000000000000000  0x000000c0001611e0 
0x000000c00006b680:  0x0000000000000000  0x0000000000000000 
0x000000c00006b690:  0x000000c00006b748  0x000000c00006b748 
0x000000c00006b6a0:  0x0000000000000020  0x000000c0001624e0 
0x000000c00006b6b0:  0x000000c000122900  0x0000000000000082 
0x000000c00006b6c0:  0x0000000000000082  0x000000000000001c 
0x000000c00006b6d0:  0x0000000000000090  0x000000000000001c 
0x000000c00006b6e0:  0x000000000000008f  0x000000000000001c 
0x000000c00006b6f0:  0x000000000000008e  0x000000000000001b 
0x000000c00006b700:  0x000000000000008e  0x000000000000001b 
0x000000c00006b710:  0x000000000000008d  0x000000000000001b 
0x000000c00006b720:  0x000000000000008c  0x000000000000001a 
0x000000c00006b730:  0x000000000000008c  0x000000000000001a 
0x000000c00006b740:  0x000000000000008b !0x000000000000001a 
0x000000c00006b750: >0x000000000000008a  0x000000000000001c 
0x000000c00006b760:  0x0000000000000090  0x000000000000002b 
0x000000c00006b770:  0x0000000000000004  0x0100000000000018 
0x000000c00006b780:  0x0000000000000000  0x000000000000008f 
0x000000c00006b790:  0x000000000000001c  0x000000000000002b 
0x000000c00006b7a0:  0x0000000000000018  0x0000000000000004 
0x000000c00006b7b0:  0x0000000000000000  0x000000c00006b7c0 
0x000000c00006b7c0:  0x0000000000000000  0x0000000000000000 
0x000000c00006b7d0:  0x000000c00007d170  0x0000000000000000 
0x000000c00006b7e0:  0x000000c00006b898  0x000000c00006b810 
0x000000c00006b7f0:  0x0000000000c0e787 <runtime.newobject+0x0000000000000027>  0x0100000000000018 
0x000000c00006b800:  0x0000000000000000  0x0000000000000000 
0x000000c00006b810:  0x000000c00006b8d0  0x0000000000f58bcd <gotrace.Trace+0x000000000000018d> 
0x000000c00006b820:  0x000000c00007d140  0x000000c00006b858 
0x000000c00006b830:  0x000000c00005c1e0  0x000000c00006b860 
0x000000c00006b840:  0x0000000000000000  0x0000000000000000 
gotrace.findpath(0x8a, 0x1c, 0x90, 0x2b, 0x4)
    D:/code/cxgo-main/.examples/potrace-go/decompose.go:233 +0x4d5 fp=0xc00006b750 sp=0xc00006b5e0 pc=0xf56af5
created by testing.(*T).Run
    C:/Program Files/Go/src/testing/testing.go:1306 +0x673

goroutine 1 [chan receive]:
testing.(*T).Run(0xc00014e000, {0xfd52b4, 0xb}, 0xfed9f0)
    C:/Program Files/Go/src/testing/testing.go:1307 +0x698
testing.runTests.func1(0xc000043d40)
    C:/Program Files/Go/src/testing/testing.go:1598 +0xcb
testing.tRunner(0xc000043d40, 0xc000107ab0)
    C:/Program Files/Go/src/testing/testing.go:1259 +0x1db
testing.runTests(0xc0000040d8, {0x11bd840, 0x1, 0x1}, {0x0, 0x0, 0x0})
    C:/Program Files/Go/src/testing/testing.go:1596 +0x410
testing.(*M).Run(0xc000144000)
    C:/Program Files/Go/src/testing/testing.go:1504 +0x9a5
main.main()
    _testmain.go:43 +0x87

goroutine 21 [IO wait]:
internal/poll.runtime_pollWait(0xc0000a8018, 0x72)
    C:/Program Files/Go/src/runtime/netpoll.go:229 +0x45
internal/poll.(*pollDesc).wait(0xc0000a81b8, 0x72, 0x0)
    C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:84 +0x88
internal/poll.execIO(0xc0000a8018, 0xfeda28)
    C:/Program Files/Go/src/internal/poll/fd_windows.go:175 +0x2d0
internal/poll.(*FD).Read(0xc0000a8000, {0xc0000aa000, 0x1000, 0x1000})
    C:/Program Files/Go/src/internal/poll/fd_windows.go:441 +0x49a
net.(*netFD).Read(0xc0000a8000, {0xc0000aa000, 0x1000, 0x1000})
    C:/Program Files/Go/src/net/fd_posix.go:56 +0x73
net.(*conn).Read(0xc000094010, {0xc0000aa000, 0x1000, 0x1000})
    C:/Program Files/Go/src/net/net.go:183 +0xa9
net/http.(*persistConn).Read(0xc000090000, {0xc0000aa000, 0x1000, 0x1000})
    C:/Program Files/Go/src/net/http/transport.go:1926 +0x1dc
bufio.(*Reader).fill(0xc0000863c0)
    C:/Program Files/Go/src/bufio/bufio.go:101 +0x294
bufio.(*Reader).Peek(0xc0000863c0, 0x1)
    C:/Program Files/Go/src/bufio/bufio.go:139 +0x178
net/http.(*persistConn).readLoop(0xc000090000)
    C:/Program Files/Go/src/net/http/transport.go:2087 +0x285
created by net/http.(*Transport).dialConn
    C:/Program Files/Go/src/net/http/transport.go:1747 +0x27f6

goroutine 22 [select]:
net/http.(*persistConn).writeLoop(0xc000090000)
    C:/Program Files/Go/src/net/http/transport.go:2386 +0x17f
created by net/http.(*Transport).dialConn
    C:/Program Files/Go/src/net/http/transport.go:1748 +0x2865

Debugger finished with exit code 0
dennwc commented 1 year ago

Potrace is now properly transpiled: https://github.com/gotranspile/gotrace. This version should.