I ported some code that I wrote in C to XC and as a result this is what I got as my build output.
**** Build of configuration Debug for project camera_with_memory ****
xmake CONFIG=Debug all
Creating dependencies for point.xc
Compiling point.xc
xcc1: internal compiler error
Failed in /build/swnb/autobuild/swview/MacOSX/build/sb/tools_xcc1_c_llvm/BackEnd/LLVM/llvmgen.c, line 9314
isExpVar(d->components->u.dimension)
For bug reporting instructions, please see:
http://www.xmos.com/support
xmake[1]: *** [.build_Debug/src/point.xc.o] Error 1
xmake: *** [bin/Debug/camera_with_memory_Debug.xe] Error 2
What could cause this? I'm real puzzled. My C code is ~80 lines. Here is the declaration:
int sort_by_col(int center_points[num_points][2], static const unsigned int num_points,
int col_idx[col_idx_size], static const unsigned int col_idx_size);
This is a bug in the compiler. It seems that you cannot declare a multidimensional array whose first dimension is a static const variable e.g.
void f(static const unsigned n) {
unsigned a[n][2];
}
This should be allowed. For future reference, since this compiler is maintained by XMOS, you can report a bug to them here:
https://www.xmos.com/en/support/contact
This bug is evident in version 13.0.2 of the XMOS compiler.
Disclosure: I work for XMOS on the compiler, so will report this bug.