From: Jakub Jelinek Date: Mon, 7 Mar 2011 22:11:55 +0000 (+0100) Subject: re PR debug/47991 (Var-tracking ICE on s390x *setmem_long insn) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7148991ec3e8a98f2fce90ef7d1073fc07764f2;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 413b5467bcc..8b1b64fc47e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-07 Jakub Jelinek + + PR debug/47991 + * var-tracking.c (find_use_val): Return NULL for + cui->sets && cui->store_p BLKmode MEMs. + 2011-03-07 Anatoly Sokolov * config/stormy16/stormy16.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71fc429469c..f5783968966 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-07 Jakub Jelinek + + PR debug/47991 + * gcc.dg/pr47991.c: New test. + 2011-03-07 Jason Merrill * g++.dg/abi/mangle46.C: New. diff --git a/gcc/testsuite/gcc.dg/pr47991.c b/gcc/testsuite/gcc.dg/pr47991.c new file mode 100644 index 00000000000..688be5c02d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr47991.c @@ -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); +} diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 7543a5a0b86..a9efcb14ecf 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -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;