This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR41295] discard post-reload debug var_location referencing pseudos


Alexandre Oliva <aoliva@redhat.com> wrote:
> This patch reworks the equivalence substitution code used for debug
> insns at the end of reload so as to detect the case of an unallocated
> pseudo, and discard the entire debug expression.
> 
> Ok to install, if it passes regression testing?

I've tested the patch on sh4-unknown-linux-gnu and got
a failure during compiling target libiberty:

/exp/ldroot/dodes/xsh-gcc/./gcc/xgcc -B/exp/ldroot/dodes/xsh-gcc/./gcc/ -B/usr/local/sh4-unknown-linux-gnu/bin/ -B/usr/local/sh4-unknown-linux-gnu/lib/ -isystem /usr/local/sh4-unknown-linux-gnu/include -isystem /usr/local/sh4-unknown-linux-gnu/sys-include    -c -DHAVE_CONFIG_H -g -O2  -I. -I../../../LOCAL/trunk/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  ../../../LOCAL/trunk/libiberty/sort.c -o sort.o
../../../LOCAL/trunk/libiberty/sort.c: In function 'sort_pointers':
../../../LOCAL/trunk/libiberty/sort.c:131:1: internal compiler error: in df_insn_rescan_debug_internal, at df-scan.c:1323

though it can be another problem.

Here is a reduced testcase which fails with -O -g.  This
fails also on sh-unknown-elf compiler with the patch.

void
sort_pointers (int n, void **pointers, void **work)
{
  int count[((127 * 2 + 1) + 1)];
  int big_endian_p;
  int i, j;

  for (i = 0, j = 0; i < sizeof (int); ++i) {  }
  big_endian_p = (((char *)&j)[0] == 0);
  for (i = 0; i < sizeof (void *) / sizeof (char); ++i)
    {
      char *digit, *bias;
      int *countp;
      void **pointerp;

      if (big_endian_p)
	j = sizeof (void *) / sizeof (char) - i;
      memset (count, 0, ((127 * 2 + 1) + 1) * sizeof (int));
      for (digit = bias; countp < count + ((127 * 2 + 1) + 1); ++countp)
	*countp += countp[-1];
      for (pointerp = pointers + n - 1; pointerp >= pointers; --pointerp)
	work[--count[((char *) pointerp)[j]]] = *pointerp;
    }
}

gdb shows that the assert

1323	  gcc_assert (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)));

fails with the insn

(debug_insn 132 131 134 3 xxx.c:9 (var_location:SI big_endian_p (eq:SI (const_int 0 [0x0])
        (const_int 0 [0x0]))) -1 (nil))

#0  fancy_abort (file=0x876f500 "../../LOCAL/trunk/gcc/df-scan.c", line=1323, 
    function=0x876fef9 "df_insn_rescan_debug_internal")
    at ../../LOCAL/trunk/gcc/diagnostic.c:728
#1  0x081b910f in df_insn_rescan_debug_internal (insn=0xb7f96534)
    at ../../LOCAL/trunk/gcc/df-scan.c:1323
#2  0x0839c5fd in reload (first=0xb7f92ce0, global=1)
    at ../../LOCAL/trunk/gcc/reload1.c:1288

Regards,
	kaz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]