Bad codegen for distinct + importc - sighashes regression #5137

Closed
nigredo-tori opened this Issue Dec 22, 2016 · 0 comments

Projects

None yet

1 participant

@nigredo-tori
Contributor

Reduced example:

type
  MyInt {.importc: "int".} = object
  MyIntDistinct = distinct MyInt

proc foo(d: MyIntDistinct) =
  discard d.MyInt

This fails to compile with both C and C++ backends:

Error: execution of an external compiler program 'gcc -c  -w  -I/home/dmitry/work/nim/lib -o /home/dmitry/work/tmp/nimcache/dups_test_importc.o /home/dmitry/work/tmp/nimcache/dups_test_importc.c' failed with exit code: 1

/home/dmitry/work/tmp/nimcache/dups_test_importc.c:10:46: error: unknown type name ‘TY_sNJOHlYHf9bp0APC8n6J3OA’
 N_NIMCALL(void, foo_pKTZ0EnB9aUruKGePNQQMoA)(TY_sNJOHlYHf9bp0APC8n6J3OA d0);
                                              ^
/home/dmitry/work/tmp/nimcache/dups_test_importc.c:49:46: error: unknown type name ‘TY_sNJOHlYHf9bp0APC8n6J3OA’
 N_NIMCALL(void, foo_pKTZ0EnB9aUruKGePNQQMoA)(TY_sNJOHlYHf9bp0APC8n6J3OA d0) {
                                              ^

Bisect points to 860cbd3

@Araq Araq added a commit that closed this issue Dec 22, 2016
@Araq Araq fixes #5137 7bd473c
@Araq Araq closed this in 7bd473c Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment