This is related to C/C++ and not directly related to CUDA. Well, it’s part of a CUDA project.
In CS 101 I was taught that statically defined arrays could not depend on something like:
int N=atoi(argv[1]);
float arrayOfFloats[N];
However, both NVCC, for compiling, and GCC 4.6, linking, ate this up and had no complains. Does the compiler cleverly replaces it by a heap allocation?
What is the behavior for this sort of thing, other than the segmentation fault I got. Shouldn’t the compiler complain a-priori?
[EDIT:]
I had a similar thing on an OpenCL project (my bad) that complained neither at compile nor at runtime on one system, but for other systems crashed. Is unexpected, isn’t it?