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 24
    • Merge requests 24
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #1954
Closed
Open
Created Jul 30, 2009 by Artem Shinkarov@temaOwner

Mark MemVals fails

Bugzilla Link 537
Created on Jul 30, 2009 19:14
Resolution FIXED
Resolved on Aug 09, 2009 17:57
Version 1.00beta
OS Linux
Architecture PC

Extended Description

Here is a bugreport:
/*
 * SAC - bug report
 * ================
 *
 * automatically generated on Thu Jul 30 19:11:14 BST 2009
 *
 * using sac2c v1.00-beta (Buchette d'Anjou) rev 16226 for linux-gnu_i686
 * built Fri Jul 24 15:22:58 BST 2009.
 * by user asv on host obelix for linux-gnu.
 *
 * The compiler was called by
 *  sac2c test.sac
 *
 * The contents of test.sac is:
 */
use StdIO: all;
use Array: all;
int[.], int
get_bits(int[.] array, int index, int count) {
    
    res = [:int];
    status = 0;
    if (index + count> shape(array)[0]) {
        status = 1;
    }
    else {
        res = tile([count], [index], array);
    }
    
    return (res, status);
}
int, int
int_from_bits(int[.] array) {
    res = 0;
    status = 0;
    
    if (shape(array)[0] > 32) {
        status = 1;
    }
    else {
        print(array);
        pow = 1;
        for (j=shape(array)[0]-1; j>=0; j--) {
            res += (array[j] * pow);
            /*printf("%u, %u\n", j, array[j] * pow);*/
            pow *= 2;
        }
    }
    return (res, status);
}
int main() {
    array  = FibreScanIntArray();
    p, err1 = get_bits(array, 0, 16);
    x, err2 = int_from_bits(p);
    return (0);
}
The program brakes when we do not use "res += (array[j] * pow)" inside of `int_from_bits' function.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking