Skip to content

SRA fails on small test with specific modula index array access #17

@alexsusu

Description

@alexsusu

Hi.
A somewhat important issue: SRA (at least the one at http://cuda.dcc.ufmg.br/dawn/index.php) isn't able to analyze the below program - I prefer using the MODULO macro with conditional statements (the other one below seems to work with SRA).

#define SIZE 128

//typedef long TYPE;
typedef int TYPE;
//typedef short TYPE;

// Unfortunately, in C language: -1 % 4 = -1
//#define MODULO(val, SIZE) ((val < 0) ? (SIZE + val) : ((val >= SIZE) ? val - SIZE : val) )
// However, this macro WORKS with SRA: #define MODULO(val, SIZE) ((val + SIZE) % SIZE)

TYPE tmp[SIZE];
TYPE tmpF[SIZE];

//void Shift(TYPE tmp[SIZE], TYPE tmpF[SIZE], TYPE d) {
void Shift(TYPE d) {
TYPE k;

for (k = 0; k < SIZE; k++)
    tmpF[k] = tmp[MODULO(k + d, SIZE)];

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions