Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 403
    • Issues 403
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #1287
Closed
Open
Created Oct 29, 2014 by Robert Stewart@rstGuest

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;`.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking