-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
We need to hijack a return from a function to commit results from it. However, there are problems when return from main is rerouted to a different routine, like in MILC:
void normal_exit()
{
exit(0);
}
int main()
{
...
normal_exit();
}
Running simplifycfg works on MILC, turning the return from main into an unreachable, but not on all examples of the problem.
#include <cmath>
#include <cstdlib>
#include "ExtraPInstrumenter.hpp"
// Reproduces a bug scenario where return from function is unreachable.
// Running `simplify-cfg` pass is necessary to turn return into unreachable
// code and putting loop commit calls correctly before the exit.
void exit_program()
{
exit(0);
}
int main(int argc, char ** argv)
{
int x1 EXTRAP = atoi(argv[1]);
int x2 EXTRAP = 2*atoi(argv[2]);
register_variable(&x1, VARIABLE_NAME(x1));
register_variable(&x2, VARIABLE_NAME(x2));
int sum = 0;
for(int i = x1; i < x2; i++)
++sum;
exit_program();
return 0;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working