[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[csmith-dev] Checking etype of statements.



Hi, below are sample codes-

Sample code 1:

func_1(void){
    int32_t l_55 = 0xC80D6736L;
    int32_t l_1432 = 0x8563A9AAL;
    int32_t l_1434 = 0xFDCA653AL;
    int32_t l_1435 = 0L;
   
    .....declarations of variables and assignments

    int i,j,k;
    for (i = 0; i < 9; i++)
    {
        for (j = 0; j < 1; j++)
        {
                 for (k = 0; k < 1; k++)
                      l_1453[i][j][k] = &g_1174[5];
        }
    }
   
    if(expr){}
    else{}
    assignment statement
    assignment statement
    return statement

}



sample code 2:

func(){
    for (i = 0; i < 9; i++)
        assignment statement and no block braces
    for()
        assignment statement and no block braces
    for()
        assignment statement and no block braces
   
    if(expr){}
    else{}
    assignment statement
    assignment statement
    return statement

}

I an unable to figure out why the first for loop is not considered as a statement. (Though the grammer states that a for loop with block end as statement).

When I try to print the statements in a function let's say first block, ie block 0,
using

        for (int i=0; i < Funclist[0]->blocks[0]->stms.size(); i++)
            cout << "\nStatenent etype:" Funclist[0]->blocks[0]->stms[1]->eType:

it's just giving me output as for sample code 1

3=IfElse statement
0=Assignment
0=Assignment
5=Return

which should have been

2=For statement
3=IfElse statement
0=Assignment
0=Assignment
5=Return

Also why aren't the local variable's declarations and assignments not considered as statements, how can they be located inside block?