vtil-project / VTIL-Core

Virtual-machine Translation Intermediate Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stack overflow during simpilfication.

zzz9328fb opened this issue · comments

void test_vtil_crash()
{
expression X_00, X_01, X_02, X_03;
expression a,b,c;
X_00 = expression(unique_identifier("X_00"), 1);
X_01 = expression(unique_identifier("X_01"), 1);
X_02 = expression(unique_identifier("X_02"), 1);
X_03 = expression(unique_identifier("X_03"), 1);
a = ~(((X_03 & X_00) ^ (X_02 & X_01)) & (X_01 & X_00));
b = ((X_03 & X_00) ^ (X_02 & X_01));
printf("a = %s\n", a.to_string().c_str());
printf("b = %s\n", b.to_string().c_str());
c = ~(a & b); //crash at here
printf("c = %s\n", c.to_string().c_str());
}

Hey, seems like there's an invalid directive causing a stack overflow, checking it right now, will fix and let you know in 1-2 hours.

expression X_00 = { {"X_00"}, 1 }; 
expression X_01 = { {"X_01"}, 1 }; 
expression X_02 = { {"X_02"}, 1 }; 
expression X_03 = { {"X_03"}, 1 };

expression a = ~( ( ( X_03 & X_00 ) ^ ( X_02 & X_01 ) ) & ( X_01 & X_00 ) );
log( "a = %s\n", a.to_string() );

expression b = ( ( X_03 & X_00 ) ^ ( X_02 & X_01 ) );
log( "b = %s\n", b.to_string() );

expression c = ~( a & b );
log( "c = %s\n", c.to_string() );

Snippet above produces the result below now:

a = ~(((X_03&X_00)^(X_02&X_01))&(X_01&X_00))
b = ((X_03&X_00)^(X_02&X_01))
c = (~((X_03&X_00)^(X_02&X_01))|(X_01&X_00))

Thanks for creating the issue and let me know if you experience any other problems :)