re PR debug/47991 (Var-tracking ICE on s390x *setmem_long insn)

PR debug/47991
	* var-tracking.c (find_use_val): Return NULL for
	cui->sets && cui->store_p BLKmode MEMs.

	* gcc.dg/pr47991.c: New test.

From-SVN: r170759
This commit is contained in:
Jakub Jelinek 2011-03-07 23:11:55 +01:00 committed by Jakub Jelinek
parent 691a924baf
commit c7148991ec
4 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-03-07 Jakub Jelinek <jakub@redhat.com>
PR debug/47991
* var-tracking.c (find_use_val): Return NULL for
cui->sets && cui->store_p BLKmode MEMs.
2011-03-07 Anatoly Sokolov <aesok@post.ru>
* config/stormy16/stormy16.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS):

View File

@ -1,3 +1,8 @@
2011-03-07 Jakub Jelinek <jakub@redhat.com>
PR debug/47991
* gcc.dg/pr47991.c: New test.
2011-03-07 Jason Merrill <jason@redhat.com>
* g++.dg/abi/mangle46.C: New.

View File

@ -0,0 +1,25 @@
/* PR debug/47991 */
/* { dg-do compile } */
/* { dg-options "-g -Os" } */
typedef __SIZE_TYPE__ size_t;
extern inline __attribute__ ((__always_inline__))
void *
memset (void *x, int y, size_t z)
{
return __builtin___memset_chk (x, y, z, __builtin_object_size (x, 0));
}
void
foo (unsigned char *x, unsigned char *y, unsigned char *z,
unsigned char *w, unsigned int v, int u, int t)
{
int i;
for (i = 0; i < t; i++)
{
memset (z, x[0], v);
memset (w, y[0], v);
x += u;
}
__builtin_memcpy (z, x, u);
}

View File

@ -1,5 +1,5 @@
/* Variable tracking routines for the GNU compiler.
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@ -4784,12 +4784,19 @@ find_use_val (rtx x, enum machine_mode mode, struct count_use_info *cui)
if (cui->sets)
{
/* This is called after uses are set up and before stores are
processed bycselib, so it's safe to look up srcs, but not
processed by cselib, so it's safe to look up srcs, but not
dsts. So we look up expressions that appear in srcs or in
dest expressions, but we search the sets array for dests of
stores. */
if (cui->store_p)
{
/* Some targets represent memset and memcpy patterns
by (set (mem:BLK ...) (reg:[QHSD]I ...)) or
(set (mem:BLK ...) (const_int ...)) or
(set (mem:BLK ...) (mem:BLK ...)). Don't return anything
in that case, otherwise we end up with mode mismatches. */
if (mode == BLKmode && MEM_P (x))
return NULL;
for (i = 0; i < cui->n_sets; i++)
if (cui->sets[i].dest == x)
return cui->sets[i].src_elt;