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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems this goes wrong during combine.
Before it is able to figure out that (p & 0xfffe) is identical to (p & 0xfffe)
% 0xffff (correct), and so we get:
(note 4 0 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 4 3 2 (set (reg/v:SI 91 [ p ])
        (reg:SI 5 di [ p ])) "pr79388.c":8 82 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 5 di [ p ])
        (nil)))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(note 6 3 7 2 NOTE_INSN_DELETED)
(note 7 6 9 2 NOTE_INSN_DELETED)
(note 9 7 11 2 NOTE_INSN_DELETED)
(note 11 9 12 2 NOTE_INSN_DELETED)
(note 12 11 14 2 NOTE_INSN_DELETED)
(note 14 12 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(note 16 15 18 2 NOTE_INSN_DELETED)
(note 18 16 20 2 NOTE_INSN_DELETED)
(note 20 18 21 2 NOTE_INSN_DELETED)
(insn 21 20 22 2 (parallel [
            (set (reg/v:SI 91 [ p ])
                (and:SI (reg/v:SI 91 [ p ])
                    (const_int 65534 [0xfffe])))
            (clobber (reg:CC 17 flags))
        ]) "pr79388.c":11 389 {*andsi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
(insn 22 21 23 2 (set (mem/c:SI (symbol_ref:DI ("c") [flags 0x2] <var_decl
0x7ffff7ff5ea0 c>) [1 c+0 S4 A32])
        (reg/v:SI 91 [ p ])) "pr79388.c":12 82 {*movsi_internal}
     (nil))
(insn 23 22 24 2 (set (reg:SI 103 [ a ])
        (mem/c:SI (symbol_ref:DI ("a") [flags 0x2] <var_decl 0x7ffff7ff5e10 a>)
[1 a+0 S4 A32])) "pr79388.c":13 82 {*movsi_internal}
     (nil))
(insn 24 23 29 2 (parallel [
            (set (reg:SI 102)
                (plus:SI (reg/v:SI 91 [ p ])
                    (reg:SI 103 [ a ])))
            (clobber (reg:CC 17 flags))
        ]) "pr79388.c":13 215 {*addsi_1}
     (expr_list:REG_DEAD (reg:SI 103 [ a ])
        (expr_list:REG_DEAD (reg/v:SI 91 [ p ])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (expr_list:REG_EQUAL (plus:SI (reg/v:SI 91 [ p ])
                        (mem/c:SI (symbol_ref:DI ("a") [flags 0x2] <var_decl
0x7ffff7ff5e10 a>) [1 a+0 S4 A32]))
                    (nil))))))
(insn 29 24 30 2 (set (reg/i:SI 0 ax)
        (reg:SI 102)) "pr79388.c":14 82 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 102)
        (nil)))
(insn 30 29 0 2 (use (reg/i:SI 0 ax)) "pr79388.c":14 -1
     (nil))

But then try_combine is called with i3 24 and i2 23 and for some reason
turns that into a load from the mem alone (as if (reg:SI 91) is 0).

Reply via email to