Bug 47991 - [4.6 Regression] Var-tracking ICE on s390x *setmem_long insn
Summary: [4.6 Regression] Var-tracking ICE on s390x *setmem_long insn
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2011-03-04 18:19 UTC by Jakub Jelinek
Modified: 2011-03-07 22:17 UTC (History)
0 users

See Also:
Host:
Target: s390x-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-03-04 18:36:14


Attachments
gcc46-pr47991.patch (949 bytes, patch)
2011-03-04 18:37 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2011-03-04 18:19:40 UTC
/* { 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);
}

ICEs on s390x-linux in var-tracking, because
(insn 56 71 57 5 (parallel [
            (clobber (reg:TI 6 %r6))
            (set (mem:BLK (subreg:DI (reg:TI 6 %r6) 0) [0 A8])
                (reg:DI 10 %r10 [95]))
            (use (reg:TI 6 %r6))
            (use (reg:TI 2 %r2))
            (clobber (reg:CC 33 %cc))
        ]) pr47372.i:9 115 {*setmem_long}
     (expr_list:REG_DEAD (reg:DI 10 %r10 [95])
        (expr_list:REG_DEAD (reg:DI 7 %r7)
            (expr_list:REG_UNUSED (reg:CC 33 %cc)
                (expr_list:REG_UNUSED (reg:TI 6 %r6)
                    (nil))))))
is really weird.  But we already allow (set (mem:BLK ...) (const_int ...))
for memset, and while this one is much worse than that, let's workaround it in var-tracking too.
Not sure if this is a problem in 4.5 too, certainly not in 4.4 which didn't have VTA.
Comment 1 Jakub Jelinek 2011-03-04 18:37:41 UTC
Created attachment 23545 [details]
gcc46-pr47991.patch

Untested fix.
Comment 2 Jakub Jelinek 2011-03-07 22:11:59 UTC
Author: jakub
Date: Mon Mar  7 22:11:55 2011
New Revision: 170759

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170759
Log:
	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.

Added:
    trunk/gcc/testsuite/gcc.dg/pr47991.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/var-tracking.c
Comment 3 Jakub Jelinek 2011-03-07 22:17:28 UTC
Fixed.