1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| class A { public: int i = 0; char c = 0; };
int main() { A *pa = new A[2]; pa->i = 10; printf("%d\n", pa->i); delete[] pa; } // ------------------------------- main: .LFB4945: .loc 1 11 0 .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r13 pushq %r12 pushq %rbx subq $24, %rsp .cfi_offset 13, -24 .cfi_offset 12, -32 .cfi_offset 3, -40 .loc 1 12 0 movl $16, %edi call _Znam@PLT movq %rax, %r13 movq %r13, %rax movl $1, %ebx movq %rax, %r12 .L4: .loc 1 12 0 is_stmt 0 discriminator 3 testq %rbx, %rbx // 推出循环的条件~ js .L3 .loc 1 12 0 discriminator 2 movq %r12, %rdi call _ZN1AC1Ev addq $8, %r12 subq $1, %rbx jmp .L4 // 循环~ .L3: .loc 1 12 0 movq %r13, -40(%rbp) .loc 1 13 0 is_stmt 1 movq -40(%rbp), %rax movl $10, (%rax) .loc 1 14 0 movq -40(%rbp), %rax addq $8, %rax movl $20, (%rax) .loc 1 15 0 movq -40(%rbp), %rax movl (%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rdi movl $0, %eax call printf@PLT .loc 1 16 0 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rdi movl $0, %eax call printf@PLT .loc 1 17 0 cmpq $0, -40(%rbp) je .L5 .loc 1 17 0 is_stmt 0 discriminator 1 movq -40(%rbp), %rax movq %rax, %rdi call _ZdaPv@PLT // 删除数组只有 this? .L5: .loc 1 18 0 is_stmt 1 movl $0, %eax addq $24, %rsp popq %rbx popq %r12 popq %r13 popq %rbp .cfi_def_cfa 7, 8 ret
|