Skip to content

Instantly share code, notes, and snippets.

@mys721tx
Created June 5, 2014 11:36
Show Gist options
  • Save mys721tx/da2042f3fc129b466080 to your computer and use it in GitHub Desktop.
Save mys721tx/da2042f3fc129b466080 to your computer and use it in GitHub Desktop.
gcc-4.9 @ Arch Linux optimization for unused variables.
int main(int argc, char *argv[])
{
int i,j;
i = 0;
return 0;
}
.file "test1.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -20(%rbp)
movq %rsi, -32(%rbp)
movl $0, -4(%rbp)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.9.0 20140521 (prerelease)"
.section .note.GNU-stack,"",@progbits
int main(int argc, char *argv[])
{
int i;
i = 0;
return 0;
}
.file "test2.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -20(%rbp)
movq %rsi, -32(%rbp)
movl $0, -4(%rbp)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.9.0 20140521 (prerelease)"
.section .note.GNU-stack,"",@progbits
int main(int argc, char *argv[])
{
int i,j;
i = 0;
j = 0;
return 0;
}
.file "test3.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -20(%rbp)
movq %rsi, -32(%rbp)
movl $0, -4(%rbp)
movl $0, -8(%rbp)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.9.0 20140521 (prerelease)"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment