-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from AjayBrahmakshatriya/master
Fixed bug in RCE
- Loading branch information
Showing
8 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ void bar (void) { | |
y_0[0] = y_0[0] - x_2; | ||
y_0[x_2] = y_0[x_2] / 2; | ||
} | ||
(y_0[0] = y_0[0] + 1) - 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
void bar (void) { | ||
int x_0 = 0; | ||
int* y_1 = (&(x_0)); | ||
(y_1[0] = y_1[0] + 1) - 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ void bar (void) { | |
var0[0] = var0[0] - var2; | ||
var0[var2] = var0[var2] / 2; | ||
} | ||
(var0[0] = var0[0] + 1) - 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
void bar (void) { | ||
int var0 = 0; | ||
int* var1 = (&(var0)); | ||
(var1[0] = var1[0] + 1) - 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ static void bar(void) { | |
*y -= x; | ||
y[x] /= 2; | ||
} | ||
|
||
(*y)++; | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Include the headers | ||
#include "blocks/c_code_generator.h" | ||
#include "builder/static_var.h" | ||
#include "builder/dyn_var.h" | ||
#include "blocks/rce.h" | ||
#include <iostream> | ||
|
||
// Include the BuildIt types | ||
using builder::dyn_var; | ||
using builder::static_var; | ||
|
||
static void bar(void) { | ||
// Insert code to stage here | ||
|
||
dyn_var<int> x = 0; | ||
dyn_var<int*> y = &x; | ||
|
||
(*y)++; | ||
|
||
|
||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
builder::builder_context context; | ||
auto ast = context.extract_function_ast(bar, "bar"); | ||
block::eliminate_redundant_vars(ast); | ||
block::c_code_generator::generate_code(ast, std::cout, 0); | ||
return 0; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters