[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 Iain Buclaw changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #6 from Iain Buclaw --- (releases/gcc-9) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking pr.cc: In function ‘int main()’: pr.cc:45:5: note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location 45 | int main (void) | ^~~~ pr.cc:45:5: note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location (releases/gcc-10) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking pr.cc: In function ‘int main()’: pr.cc:45:5: note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location 45 | int main (void) | ^~~~ pr.cc:45:5: note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location pr.cc:45:5: note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location (releases/gcc-11) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking (releases/gcc-12) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking (releases/gcc-13) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking (trunk) $ ./gcc/xg++ -B ./gcc/ pr.cc -O2 -g -fchecking Minimal test is only reproducible on the 9.x and 10.x compilers, and I've not seen it crop up again in any D testsuite runs. I'll just close this then.
[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 Iain Buclaw changed: What|Removed |Added Attachment #48953|0 |1 is obsolete|| --- Comment #5 from Iain Buclaw --- Created attachment 49009 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49009&action=edit favour tls_mem_loc_descriptor Patch leaves delegitimize alone and instead plugs the warning in dwarf2out.c. If MEM is a TLS reference, then try tls_mem_loc_descriptor() first. No observed changes in either assembly or debug as a result of the patch.
[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 Iain Buclaw changed: What|Removed |Added Attachment #48946|0 |1 is obsolete|| --- Comment #4 from Iain Buclaw --- Created attachment 48953 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48953&action=edit delegitimize mem(plus (unspec reg) tls) Second patch, this time dealing with the following insn --- (mem/f/c:DI (plus:DI (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TP) (reg:DI 89)) [1 MEM [(struct Darray *)&testYearsBC + 8B]+0 S8 A64]) --- After ix86_delegitimize_tls_address, it becomes --- (mem/f/c:DI (reg/f:DI 6 bp [90]) [1 MEM [(struct Darray *)&testYearsBC + 8B]+0 S8 A64]) --- Doesn't change assembly produced for given test, but alters debug output: --- @@ -1105,12 +1105,9 @@ testYearsBC: .LLST4: .quad .LVL7 .quad .LVL8-1 - .value 0xd - .byte 0xe - .long testYearsBC@dtpoff, 0 - .byte 0xe0 - .byte 0x23 - .uleb128 0x8 + .value 0x3 + .byte 0x76 + .sleb128 0 .byte 0x6 .quad 0 .quad 0 @@ -1148,15 +1145,12 @@ testYearsBC: .LLST6: .quad .LVL9 .quad .LVL9 - .value 0x11 + .value 0x7 .byte 0x50 .byte 0x93 .uleb128 0x8 - .byte 0xe - .long testYearsBC@dtpoff, 0 - .byte 0xe0 - .byte 0x23 - .uleb128 0x8 + .byte 0x76 + .sleb128 0 .byte 0x93 .uleb128 0x8 .quad 0 @@ -1167,15 +1161,12 @@ testYearsBC: .LLST7: .quad .LVL9 .quad .LVL9 - .value 0x11 + .value 0x7 .byte 0x50 .byte 0x93 .uleb128 0x8 - .byte 0xe - .long testYearsBC@dtpoff, 0 - .byte 0xe0 - .byte 0x23 - .uleb128 0x8 + .byte 0x76 + .sleb128 0 .byte 0x93 .uleb128 0x8 .quad 0 ---
[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 --- Comment #3 from Iain Buclaw --- 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 - leaq8+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 leaq17(%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 callabort@PLT .cfi_endproc .LFE4:
[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 --- Comment #2 from Iain Buclaw --- Possibly some useful information for context. At expand_expr_real_1 (expr.c:10567) there is the following expression. --- MEM [(struct Darray *)&testYearsBC + 8B] --- Lowered to RTL as --- (plus:DI (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TP) (const:DI (plus:DI (unspec:DI [ (symbol_ref:DI ("testYearsBC") [flags 0x2a] ) ] UNSPEC_NTPOFF) (const_int 8 [0x8] --- At break_out_memory_refs (explow.c:277) the rhs of the plus expression is forced into a register. --- (insn 18 17 0 (set (reg:DI 89) (const:DI (plus:DI (unspec:DI [ (symbol_ref:DI ("testYearsBC") [flags 0x2a] ) ] UNSPEC_NTPOFF) (const_int 8 [0x8] -1 (nil)) (mem/f/c:DI (plus:DI (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TP) (reg:DI 89)) [1 MEM [(struct Darray *)&testYearsBC + 8B]+0 S8 A64]) --- And it is the second insn that reaches const_ok_for_output_1() at mem_loc_descriptor (dwarf2out.c:15748) --- (note 133 132 163 3 (var_location year (mem:SI (mem/f/c:DI (plus:DI (unspec:DI [ (const_int 0 [0]) ] UNSPEC_TP) (reg/f:DI 6 bp [90])) [1 MEM [(struct Darray *)&testYearsBC + 8B]+0 S8 A64]) [6 *rs$pt r_5+0 S4 A32])) NOTE_INSN_VAR_LOCATION) ---
[Bug target/96347] note: non-delegitimized UNSPEC UNSPEC_TP (19) found in variable location
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96347 Iain Buclaw changed: What|Removed |Added Target||x86_86-linux-gnu Build||x86_86-linux-gnu Known to work||8.4.0 Known to fail||10.1.0, 11.0, 9.3.0 Host||x86_86-linux-gnu --- Comment #1 from Iain Buclaw --- (In reply to Iain Buclaw from comment #0) > Created attachment 48938 [details] > test case > > Attached test that was translated to C++ from D after being minimised. Forgot to mention, needs to be compiled with: -O2 -g -fchecking