Bug 47187 - [4.6 Regression] profiledbootstrap failure on i386
Summary: [4.6 Regression] profiledbootstrap failure on i386
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-checking, wrong-code
Depends on:
Blocks:
 
Reported: 2011-01-06 10:01 UTC by Jakub Jelinek
Modified: 2011-01-07 18:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-01-06 10:06:53


Attachments
gcc46-pr47187.patch (829 bytes, patch)
2011-01-06 10:29 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-01-06 10:01:33 UTC
profiledbootstrap currently fails on i386, with --enable-checking=release rtl.c (copy_rtx) is miscompiled (after giving a bogus warning that copy is uninitialized (well, in the generated code it is), with checking it ICEs:
../../gcc/rtl.c: In function ‘copy_rtx’:
../../gcc/rtl.c:236:1: error: SSA_NAME_DEF_STMT is wrong
Expected definition statement:
# .MEM_93 = VDEF <.MEM_91>
    D.27976_89 = memcpy (copy.26_86, orig.25_85, 12);

Actual definition statement:
# .MEM_92 = VDEF <.MEM_91>
    D.27976_89 = memcpy (copy.26_86, orig.25_85, D.27973_83);
../../gcc/rtl.c:236:1: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

This is caused by a bug in gimple_stringop_fixed_value where it doesn't handle lhs properly.  Small testcase:
char buf[64];
char buf2[64];

void *
foo (char *p, long size)
{
  return __builtin_memcpy (buf, p, size);
}

int
main (void)
{
  long i;
  for (i = 0; i < 65536; i++)
    if (foo ("abcdefghijkl", 12) != buf)
      __builtin_abort ();
  if (foo (buf2, 64) != buf)
    __builtin_abort ();
  return 0;
}

./xgcc -B ./ -O2 -fprofile-generate test.c -o test
./test
./xgcc -B ./ -O2 -fprofile-use test.c -o test
Comment 1 Jakub Jelinek 2011-01-06 10:06:53 UTC
I'll take care of it.
Comment 2 Jakub Jelinek 2011-01-06 10:29:49 UTC
Created attachment 22911 [details]
gcc46-pr47187.patch

Very lightly tested fix.
Comment 3 Jakub Jelinek 2011-01-07 18:39:14 UTC
Author: jakub
Date: Fri Jan  7 18:39:11 2011
New Revision: 168581

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168581
Log:
	PR bootstrap/47187
	* value-prof.c (gimple_stringop_fixed_value): Handle
	lhs of the call properly.

	* gcc.dg/tree-prof/pr47187.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-prof/pr47187.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/value-prof.c
Comment 4 Jakub Jelinek 2011-01-07 18:44:16 UTC
Fixed.