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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Joel Sherrill from comment #3)
> Added the dwarf maintainers hoping to get an answer. From an RTEMS
> perspective, the lm32 is not usable. Both 4.9 and the head are broken.
> Hoping you two have an idea. Happy to help since this is a cross target.

This is a target problem.

Please see stack_adjust function, where emit_move_insn is used to move an
immediate to r10. However, emit_move_insn with (const_int -32812) generates two
insn sequence:

(insn 952 123 953 2 (set (reg:SI 10 r10)
        (const_int -65536 [0xffffffffffff0000]))
../../../../../../rtems/c/src/../../cpukit/libdl/fastlz.c:167 -1
     (nil))
(insn/f 953 952 954 2 (set (reg:SI 10 r10)
        (ior:SI (reg:SI 10 r10)
            (const_int 32724 [0x7fd4])))
../../../../../../rtems/c/src/../../cpukit/libdl/fastlz.c:167 -1
     (expr_list:REG_EQUAL (const_int -32812 [0xffffffffffff7fd4])
        (nil)))

However:

      /* r10 is caller saved so it can be used as a temp reg.  */
      rtx r10;
      r10 = gen_rtx_REG (word_mode, 10);
      insn = emit_move_insn (r10, GEN_INT (amount));
      if (amount < 0)
    RTX_FRAME_RELATED_P (insn) = 1;

emit_move_insn returns only the *last* insn of the sequence (insn 953 in the
above dump). (insn 952) doesn't get RTX_FRAME_RELATED_P flag set - please note
lack of /f modifier - and consequently dwarf2out_frame_debug_expr trips in Rule
7 due to unknown cfa_temp.reg (which would be otherwise initialized in insn
952, following Rule 6).

So, considering that emit_move_insn can generate a sequence of insns, but only
the last insn is returned as a return value of a function,

      insn = emit_move_insn (r10, GEN_INT (amount));
      RTX_FRAME_RELATED_P (insn) = 1;

is not the correct way to set /f flags to all insn of the generated sequence.

Reply via email to