This code produces an error in Pelles: "fatal error: Internal error: liveness_usesite()."
#include <stdio.h>
int len1;
int len2;
void testFunction(char [len1][len2] );
void testFunction(char arr[len1][len2] ) //issue is here with char arr[len1][len2]
{
printf("%s" , arr[len1-1] ) ;
}
int main(int argc,char *argv[])
{
len1 = 10 ;
len2 = 20 ;
char array[len1][len2] ;
array[len1-1][0] = 'a' ;
array[len1-1][1] = '\0' ;
testFunction( array ) ;
return 0;
}
Yet this code compiles on gcc: "gcc -Wall -std=c99 -lm filename.c" and on
http://ideone.com/iAEXpg and a couple of other compilers, without any errors or warnings and displays the correct output ( a ).
Only pelles displays this error.
Removing len2 from function and changing the parameter to a 1d array removes the error.
Im using the latest pelles version, code was tested on a new project (Windows 32 console exe), with default settings.
EDIT:
A more compact version of the problem
int len;
void testFunction(char arr[][len] )
{
}
int main(int argc,char *argv[])
{
return 0;
}
Again all other compilers agree this is correct
http://ideone.com/l4sqqj,
but pelles displays "main.c(4): fatal error: Internal error: liveness_usesite()."
EDIT 2:
Works correctly on 1D array
int len ;
void testFunction(char arr[len] )
{
}
int main(int argc,char *argv[])
{
return 0;
}