elliotchance/c2go

panic: unknown node type: MSAllocatorAttr

NaniteFactory opened this issue · 0 comments

Transpile panic

Command:

c2go transpile prime.c

Result:

panic: unknown node type: 'MSAllocatorAttr 0x28201f4a260 <line:187:25>'

goroutine 100 [running]:
github.com/elliotchance/c2go/ast.Parse(0xc000556983, 0x2b, 0x6dc877, 0x5)
        E:/GoPath/src/github.com/elliotchance/c2go/ast/ast.go:294 +0x4548
main.convertLinesToNodes(0xc0000d4000, 0x18a, 0x18a5, 0x0, 0x0, 0x0)
        E:/GoPath/src/github.com/elliotchance/c2go/main.go:89 +0x1ad
main.convertLinesToNodesParallel.func1.1(0xc00020c0c0, 0xc000006028, 0xc0000d4000, 0x18a, 0x18a5, 0x0)
        E:/GoPath/src/github.com/elliotchance/c2go/main.go:113 +0x5a
created by main.convertLinesToNodesParallel.func1
        E:/GoPath/src/github.com/elliotchance/c2go/main.go:111 +0x12b

Environment:

go version go1.13.7 windows/amd64
clang version 10.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
  • LLVM 10.0 is installed.

Source and AST

Source:

#include <stdio.h>
 
int main()
{
   int n, c;
 
   printf("Enter a number\n");
   scanf("%d", &n);
 
   if ( n == 2 )
      printf("Prime number.\n");
   else
   {
       for ( c = 2 ; c <= n - 1 ; c++ )
       {
           if ( n % c == 0 )
              break;
       }
       if ( c != n )
          printf("Not prime.\n");
       else
          printf("Prime number.\n");
   }
   return 0;
}

AST: ast.txt (file attatched)

c2go ast prime.c > ast.txt