Error Raised When Attempting to Assign Value At Index of Array With x86 Assembly GNU GAS
问题 I am using x86 GNU assembly with GCC and am attempting to implement the Assembly equivalent of the following c/c++ : int x[10]; x[0] = 5; However, when I attempt to run (with command ./a.out ) my Assembly code below (after first compiling with the gcc filename.s ), the error Segmentation fault: 11 is printed to the console: .data x:.fill 10 index:.int 0 .text .globl _main _main: pushq %rbp movq %rsp, %rbp subq $16, %rsp lea x(%rip), %rdi mov index(%rip), %rsi; movl $5, %eax; movl %eax, (%rdi,