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 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2316
Closed
Open
Created Oct 27, 2022 by Sven-Bodo Scholz@sbsOwner

WLSIMP leads to wrong results; bug in SCSisRelationalOnDyadicFn

When compiling and running the following code using sac2c WLSIMP-bug.sac ; ./a.out ; echo $? we obtain 11. When using sac2c WLSIMP-bug.sac -noWLSIMP; ./a.out ; echo $? we obtain the correct 42.

I use the latest release compiler sac2c 1.3.3-MijasCosta-926-gec84e9.

noinline
int[12,10] interp2x (int[12,10] phi, int[2] boundary_sizes)
{
   // if the following line is inserted, the bug disappears!
   // boundary_sizes = [1,1];
   return with {
            (boundary_sizes <= iv < _sub_VxV_( [12,10], boundary_sizes) ) :  _sel_VxA_ (iv,interp2x (phi)) ;
          } : modarray (phi);
}

inline
int[11,9] interp2x (int[12,10] phi)
{
   return with {
            ( . <= [i,j] <= .) : 42;
          } : genarray ([11,9], 0);
}



int main()
{
    v = with {
          ([0,0] <= [i,j] <[12,10]) : _add_SxS_(_mul_SxS_(i,10),j);
        } : genarray ( [12,10], 0);
    v2 = interp2x (v, [1,1]);

    // return value should be 42, not 11!

    return (_sel_VxA_([1,1], v2));
}
Edited Oct 27, 2022 by Sven-Bodo Scholz
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking