2D array assignment in for loops
|
|
Bugzilla Link |
1141 |
Created on |
Oct 29, 2014 15:25 |
Version |
svn |
OS |
Linux |
Architecture |
PC |
Extended Description
This code compiles just fine:
int main()
{
xs = [1,2,3];
for( i=0; i<3; i++) {
xs[i] = 5;
}
return 1; }
The following very similar code does not compile. The only difference is that it is assigning to a 2D array, rather than a 1D array as before.
int main()
{ xss = [[1,2,3],[4,5,6]];
for( i=0; i<2; i++) {
for( j=0; j<2; j++) {
xss[i][j] = 5;
}
}
return 1; }
The compile error is:
$ sac2c test.sac
./test.sac 5:35 error:
=> token `;' expected, `=' token found
abort: Failed to construct a syntax tree for `test.sac'
compilation failed while Loading SAC program, 1 error(s).
Line 5 is `xss[i][j] = 5;`.