-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
struct state {
int i;
};
int main()
{
struct state ss;
struct state *s = &ss;
s->i = 0;
s->i++;
return s->i;
}Causes segfault. Replacing ++ with +=1 workarounds this.
diff between two assemblies is
@@ -21,21 +21,14 @@
lea_rax,[r13+DWORD] %-16 # local variable load
mov_rax,[rax]
# looking up offset
-mov_rax,[rax]
-# postfix inc/dec
-push_rbx # Old register one value
-push_rax # Address of variable
-mov_rax,[rax] # Get value
-pop_rbx # Address of variable
-push_rax # Value before postfix operator
-push_rbx # Address of variable
-mov_r14, %1 # Add offset
-add_rax,r14 # Add offset
-pop_rbx # Address of variable
+push_rax # _common_recursion
+mov_rax, %1 # primary expr number
+pop_rbx # _common_recursion
+push_rbx # compound operator
+mov_rbx,[rbx]
+add_rax,rbx # compound operation
+pop_rbx # compound operator
mov_[rbx],rax
-pop_rax # Value before postfix operator
-pop_rbx # Previous value
-# postfix inc/dec end
lea_rax,[r13+DWORD] %-16 # local variable load
mov_rax,[rax]
# looking up offsetMetadata
Metadata
Assignees
Labels
No labels