[Bug bootstrap/50010] [4.7 regression] bootstrap comparison failure without CFI directives

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 12 08:43:00 GMT 2011


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-09-12 08:40:48 UTC ---
Created attachment 25246
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25246
gcc47-pr50010.patch

Small testcase:
static const unsigned int v[] =
{
  0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
  0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
  0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
  0x350c9b64, 0x31cd86d3, 0x3c8ea00a,
  [255] = 0x384fbdbd
};
unsigned int
foo (const unsigned char *x, int y, unsigned int z)
{
  unsigned int r = z;
  while (y--)
    {
      r = (r << 8) ^ v[((r >> 24) ^ *x) & 255];
      x++;
    }
  return r;
}

-g -dA -O2 -mtune=i586 -m32 -fpic -fno-dwarf2-cfi-asm
vs.
-g0 -dA -O2 -mtune=i586 -m32 -fpic -fno-dwarf2-cfi-asm
or just
-g -dA -O2 -mtune=i586 -m32 -fpic -fno-dwarf2-cfi-asm
vs.
-g -dA -O2 -mtune=i586 -m32 -fpic -fno-dwarf2-cfi-asm
-fno-var-tracking-assignments

The problem is that when add_cfis_to_fde is creating NOTE_INSN_CFI_LABEL notes,
it doesn't ignore NOTE_INSN_VAR_LOCATION and NOTE_INSN_CALL_ARG_LOCATION in
between the NOTE_INSN_CFI notes, so with -fvar-tracking-assignments we generate
one extra label because the NOTE_INSN_CFI notes aren't consecutive, there is
one
NOTE_INSN_VAR_LOCATION in between.  And, apparently gas for some reason doesn't
optimize away completely DW_CFA_advance_loc* if it advances by 0 (guess
something to fix).

Here is an untested fix.  It would be enough to skip over just the
NOTE_INSN_VAR_LOCATION and NOTE_INSN_CALL_ARG_LOCATION notes, but if gas
doesn't optimize zero length advances, I'd say we should skip over all non-real
insns.



More information about the Gcc-bugs mailing list