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
  • #2258
Closed
Open
Created Apr 27, 2021 by Sven-Bodo Scholz@sbsOwner

Aliasing analysis fails

Look at this code:

noinline
int[10000], int[10000] foo (int len)
{
    a =  with {
              } : genarray( [len], 2);

    if( _eq_SxS_( len, 10000)) {
        c = a;
    } else {
        c = with {
              } : genarray( [len], 4);
    }

    return (a, c);
}

int main()
{
    a,c = foo (10000);

    b = {iv-> _add_SxS_( _sel_VxA_(iv, a),1)};

    return _add_SxS_( _sel_VxA_([2], b), _sel_VxA_([2], c));
}

The function foo creates a potential alias here. However, it seems the aliasing analysis does not pick this up. What happens is that the mem phase decides that the increment in main can be done in place! After the selection into c, the runtime system attempts a free for a second time:

-sbs-Bodos-IMac-> sac2c MEMORY-error-cuda-managed.sac ; a.out
a.out(38071,0x10ca1edc0) malloc: *** error for object 0x7fe95d800000: pointer being freed was not allocated
a.out(38071,0x10ca1edc0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort
-sbs-Bodos-IMac-> sac2c -V
sac2c 1.3.3-MijasCosta-578-g3920
build-type: RELEASE
built-by: "sbs" at 2021-04-13T19:54:17
Edited Apr 27, 2021 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