I get the following assertion when trying to compile the following minimal test case. This should generate an error saying that external function calls are not supported for device functions. I spent a few hours trying to understand this assertion and my guess is that it will be helpful to other users in the future if the compiler gives valid feedback instead of throwing internal assertions. (Also a linker for device side functions would really be nice, but I’ll settle for useful error messages.)
[codebox]### Assertion failure at line 1193 of …/…/be/cg/NVISA/exp_loadstore.cxx:
Compiler Error in file /tmp/tmpxft_000034ba_00000000-7_bug.cpp3.i during Code_Expansion phase:
Extern can only be applied to global, shared, or constant
nvopencc INTERNAL ERROR: /usr/local/cuda/open64/lib//be returned non-zero status 1
[/codebox]
Here is a minimal test case that generates the assertion.
[codebox]device
void dummyFunction();
device
void *ptr;
device
void getFuncPtr()
{
void (*dummyPtr)() = dummyFunction;
ptr = (void*)dummyPtr;
}[/codebox]
I compiled this using the following command:
[codebox]nvcc -c -arch=compute_20 bug.cu[/codebox]