https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Created attachment 48946
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48946&action=edit
disallow tpoff+offset from being stored in a temp

Patch prevents the forced temp from being used to replace the rhs of the
original PLUS expr at memory_address_addr_space (explow.c:434), so the excess
errors are gone.

Alters the resultant assembly in the following way:
---
@@ -35,15 +35,11 @@ _Z5chain6Darray:
 main:
 .LFB4:
        .cfi_startproc
-       pushq   %rbp
-       .cfi_def_cfa_offset 16
-       .cfi_offset 6, -16
-       leaq    8+testYearsBC@tpoff, %rbp
        pushq   %rbx
-       .cfi_def_cfa_offset 24
-       .cfi_offset 3, -24
-       subq    $40, %rsp
-       .cfi_def_cfa_offset 64
+       .cfi_def_cfa_offset 16
+       .cfi_offset 3, -16
+       subq    $32, %rsp
+       .cfi_def_cfa_offset 48
        leaq    17(%rsp), %rbx
        jmp     .L6
        .p2align 4,,10
@@ -56,11 +52,11 @@ main:
        movl    $0, (%rbx)
        movw    %ax, 4(%rbx)
        movb    $0, 6(%rbx)
-       movq    %fs:0(%rbp), %rdx
        movq    %fs:testYearsBC@tpoff, %rax
+       movq    %fs:8+testYearsBC@tpoff, %rdx
        movb    $0, 16(%rsp)
-       movq    %rdx, 8(%rsp)
        movq    %rax, (%rsp)
+       movq    %rdx, 8(%rsp)
        testq   %rax, %rax
        je      .L7
        jmp     .L9
@@ -71,9 +67,8 @@ main:
 main.cold:
 .LFSB4:
 .L7:
-       .cfi_def_cfa_offset 64
-       .cfi_offset 3, -24
-       .cfi_offset 6, -16
+       .cfi_def_cfa_offset 48
+       .cfi_offset 3, -16
        call    abort@PLT
        .cfi_endproc
 .LFE4:

Reply via email to