c2go
c2go copied to clipboard
panic: could not match regexp with string
version $ cmake version 2.8.12.2 $ clang -v clang version 3.4.2 (tags/RELEASE_34/dot2-final) Target: x86_64-redhat-linux-gnu Thread model: posix Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.5 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.5
What I tried
#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;
}
Result
bin/c2go transpile tets.c
panic: could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)> <(?P<position2>.*)>[\s]*$
0x355fd40 <<invalid sloc>>
goroutine 209 [running]:
github.com/elliotchance/c2go/ast.groupsFromRegex(0xc0000f5f90, 0x45, 0xc000318014, 0x1a, 0xc0000fe4c0)
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/ast/ast.go:310 +0x36a
github.com/elliotchance/c2go/ast.parseTranslationUnitDecl(0xc000318014, 0x1a, 0x13)
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/ast/translation_unit_decl.go:10 +0x4e
github.com/elliotchance/c2go/ast.Parse(0xc000318000, 0x2e, 0x6b5abb, 0x5)
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/ast/ast.go:258 +0x2ea5
main.convertLinesToNodes(0xc00027a000, 0xb, 0x2c2, 0x0, 0x0, 0x0)
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/main.go:89 +0x1a6
main.convertLinesToNodesParallel.func1.1(0xc00058c000, 0xc00013c0c0, 0xc00027a000, 0xb, 0x2c2, 0x14)
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/main.go:113 +0x53
created by main.convertLinesToNodesParallel.func1
/home/gopath/pkg/mod/github.com/elliotchance/[email protected]/main.go:111 +0x12f
This means that c2go can't understand the output from that particular version of clang. Here is an example of updating the regex to fix: https://github.com/elliotchance/c2go/pull/853