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

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Possibly some useful information for context.

At expand_expr_real_1 (expr.c:10567) there is the following expression.
---
MEM <int *> [(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] <var_decl
0x7ffff7fa2bd0 testYearsBC>)
                ] 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] <var_decl
0x7ffff7fa2bd0 testYearsBC>)
                    ] 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 <int *> [(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 <int *> [(struct Darray *)&testYearsBC
+ 8B]+0 S8 A64]) [6 *rs$pt
r_5+0 S4 A32])) NOTE_INSN_VAR_LOCATION)
---

Reply via email to