Should the following code produce the compile time error: "jump into scope of identifier with variably modified type"? I can understand why the C99 Standard has this constraint if the data is dynamically reserved on the stack. But I cannot understand what the problem is when the declaration results from a simple cast to a dynamically allocated block from the heap.
void ShowVariablyModifiedTypeBug(void)
{
int rowCount = 2;
int colCount = 5;
int elementCount = rowCount * colCount;
void *dataPtr = malloc(sizeof(int) * elementCount);
if (!dataPtr) goto exit;
int (*dataArr)[colCount] = (int (*)[colCount])dataPtr;
exit:
return;
}