------- Comment #2 from danglin at gcc dot gnu dot org  2008-11-18 02:31 -------
The hppa gas target currently defines DWARF2_LINE_MIN_INSN_LENGTH to 4 in
tc-hppa.h.  I can fix this failure by changing DWARF2_LINE_MIN_INSN_LENGTH
to 1.  However, the failure appears to be caused by an inconsistency in
the handling of DW_CFA_advance_loc1, DW_CFA_advance_loc2 and
DW_CFA_advance_loc4
in dw2gencfi.c and unwind-dw2.c.

In dw2gencfi.c, we have:

            addressT delta = S_GET_VALUE (to) - S_GET_VALUE (from);
            addressT scaled = delta / DWARF2_LINE_MIN_INSN_LENGTH;

            if (scaled <= 0x3F)
              out_one (DW_CFA_advance_loc + scaled);
            else if (delta <= 0xFF)
              {
                out_one (DW_CFA_advance_loc1);
                out_one (delta);
              }
            else if (delta <= 0xFFFF)
              {
                out_one (DW_CFA_advance_loc2);
                out_two (delta);
              }
            else
              {
                out_one (DW_CFA_advance_loc4);
                out_four (delta);
              }

In unwind-dw2.c, we have:

        case DW_CFA_advance_loc1:
          fs->pc += read_1u (insn_ptr) * fs->code_align;
          insn_ptr += 1;
          break;
        case DW_CFA_advance_loc2:
          fs->pc += read_2u (insn_ptr) * fs->code_align;
          insn_ptr += 2;
          break;
        case DW_CFA_advance_loc4:
          fs->pc += read_4u (insn_ptr) * fs->code_align;
          insn_ptr += 4;
          break;

The code in binutils/dwarf.c also scales the file values by the code
alignment factor.  So two against one says the dw2gencfi.c code is wrong.


-- 

danglin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37610

Reply via email to