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 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2412
Closed
Open
Created Apr 24, 2024 by Jordy Aaldering@JordyAalderingDeveloper

Records: multioperator WL: shape of iteration space differs

The following program fails:

struct Foo {
    int[3] x;
    int y;
};

int main()
{
    foos = with {
        ([0] <= [i] < [1000]) : Foo{ [i,i,i], i };
    } : genarray([1000], Foo{ [0,0,0], 0 });
    foos.x = { [i] -> _add_SxV_(1, foos[i].x) };
    return foos[0].y;
}
Assertion "SHcompareShapes (iter_shp, ret_iter_shp)" failed at /home/jordy/sac2c/src/libsac2c/wltransform/wltransform.c:2533 -- multioperator WL: shape of iteration space differs

I believe this happens because x is a vector but y is a scalar.

shape(foos.x) = [1000, 3]
shape(foos.y) = [1000]

I have no idea if this can be fixed or whether it is a conceptual problem. Perhaps only the common prefix / outer shape ([1000]) should be equal? Likely that also requires changes in other places though...

Changing x into a scalar makes the program compile:

struct Bar {
    int x;
    int y;
};

int main()
{
    bars = with {
        ([0] <= [i] < [1000]) : Bar{ i, i };
    } : genarray([1000], Bar{ 0, 0 });
    bars.x = { [i] -> _add_SxS_(1, bars[i].x) };
    return bars[0].y;
}
Edited Apr 24, 2024 by Jordy Aaldering
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking