I tried to decompile the game Terraria and the following problems showed up in the decompiled code.
JustDecompile produces this:
where the correct code would look like:
The produced code will not compile out-of-the-box, because it would need to be in an "unsafe { }" block. It also does not really make sense at all to use unsafe pointers in this case.
The other bug I found was, in some cases code like this was generated:
this also won't compile, it should be like this:
JustDecompile produces this:
Vector2* vector2Pointer2 = &vector2;
(*(vector2Pointer2)).X = vector2Pointer2.X + x2 * 3f;
Vector2* y3 = &vector2;
(*(y3)).Y = y3.Y + y2 * 3f;
where the correct code would look like:
Vector2 vector2Pointer2 = vector2;
vector2Pointer2.X = vector2Pointer2.X + x2 * 3f;
Vector2 y3 = vector2;
y3.Y = y3.Y + y2 * 3f;
The produced code will not compile out-of-the-box, because it would need to be in an "unsafe { }" block. It also does not really make sense at all to use unsafe pointers in this case.
The other bug I found was, in some cases code like this was generated:
Vector2 vector212.X = (
float
)(r * 16);
vector212.Y = (
float
)(s * 16);
this also won't compile, it should be like this:
Vector2 vector212;
vector212.X = (
float
)(r * 16);
vector212.Y = (
float
)(s * 16);