elliotchance / c2go

⚖️ A tool for transpiling C to Go.
MIT License
2.06k stars 151 forks source link

panic: unknown node type: 'BuiltinAttr 0x1d448112da0 <<invalid sloc>> Implicit 836' #893

Open rhomari opened 1 year ago

rhomari commented 1 year ago

panic: unknown node type: 'BuiltinAttr 0x1d448112da0 <> Implicit 836'

goroutine 52 [running]: github.com/elliotchance/c2go/ast.Parse({0xc000303d90, 0x37}) C:/Users/tariq/go/src/github.com/elliotchance/c2go/ast/ast.go:294 +0x2205 main.convertLinesToNodes({0xc000169420, 0x18d, 0x66?}) C:/Users/tariq/go/src/github.com/elliotchance/c2go/main.go:89 +0x115 main.convertLinesToNodesParallel.func1.2({0xc000169420?, 0x0?, 0x0?}, 0x0?) C:/Users/tariq/go/src/github.com/elliotchance/c2go/main.go:121 +0x39 created by main.convertLinesToNodesParallel.func1 C:/Users/tariq/go/src/github.com/elliotchance/c2go/main.go:119 +0x2b3

I had this error message, please check on it.

elliotchance commented 1 year ago

Since the parser works on understanding the non-machine output of the clang AST changes and edge cases constantly need to be added. Here is an example of adding a new node: https://github.com/elliotchance/c2go/pull/832

nagylzs commented 1 year ago
 c2go transpile test.c                                                                                                                                               2 ↵
panic: unknown node type: 'BuiltinAttr 0x2101168 <<invalid sloc>> Inherited Implicit 837'

goroutine 62 [running]:
github.com/elliotchance/c2go/ast.Parse({0xc00016edb1, 0x3d})
    /home/gandalf/projects/c2go/ast/ast.go:294 +0x2205
main.convertLinesToNodes({0xc000178800, 0x3b, 0x0?})
    /home/gandalf/projects/c2go/main.go:89 +0x115
main.convertLinesToNodesParallel.func1.2({0xc000178800?, 0x0?, 0x0?}, 0x0?)
    /home/gandalf/projects/c2go/main.go:121 +0x39
created by main.convertLinesToNodesParallel.func1
    /home/gandalf/projects/c2go/main.go:119 +0x2b3

Is it the same problem, or is it a different problem? I'm trying to transpile the example C program (testing prime numbers) with go1.19.2 and this clang:

Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
ilius commented 1 year ago

Can you give me a hint how to modify my C code to make it compile to Go? Here is my panic line (I modified the message a bit):

panic: unknown node type, fullline="BuiltinAttr 0x2179f58 <<invalid sloc>> Inherited Implicit 799", nodeName="BuiltinAttr"

goroutine 9 [running]:
github.com/elliotchance/c2go/ast.Parse({0xc0001d2f11, 0x3d})
    .../github.com/elliotchance/c2go/ast/ast.go:295 +0x2228
main.convertLinesToNodes({0xc0002df680, 0x369, 0x0?})
    .../github.com/elliotchance/c2go/main.go:89 +0x115
main.convertLinesToNodesParallel.func1.2({0xc0002df680?, 0x0?, 0x0?}, 0x0?)
    .../github.com/elliotchance/c2go/main.go:121 +0x39
created by main.convertLinesToNodesParallel.func1
    .../github.com/elliotchance/c2go/main.go:119 +0x2b3

My C code: https://github.com/ilius/ls-go/blob/sort-version/c/filevercmp.c