Bug 44687 - [4.6 Regression] ICE: in tree_nrv, at tree-nrv.c:155 with -fprofile-generate
Summary: [4.6 Regression] ICE: in tree_nrv, at tree-nrv.c:155 with -fprofile-generate
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-06-27 11:14 UTC by Zdenek Sojka
Modified: 2010-07-02 13:22 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-06-28 00:21:54


Attachments
reduced testcase (from g++.dg/lto/20090221_0.C) (116 bytes, text/plain)
2010-06-27 11:15 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-06-27 11:14:48 UTC
Command line:
$ g++ -O2 -fprofile-generate testcase.C

Compiler output:
$ g++ -O2 -fprofile-generate testcase.C
testcase.C: In function 'B bar(B)':
testcase.C:16:1: internal compiler error: in tree_nrv, at tree-nrv.c:155
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r161428 - crash
r161383 - crash
r161170 - OK
Comment 1 Zdenek Sojka 2010-06-27 11:15:50 UTC
Created attachment 21015 [details]
reduced testcase (from g++.dg/lto/20090221_0.C)

Command line:
$ g++ -O2 -fprofile-generate pr44687.C
Comment 2 Andrew Pinski 2010-06-27 23:55:47 UTC
Works with:
GNU C++ (GCC) version 4.6.0 20100621 (experimental) [trunk revision 161061] (x86_64-unknown-linux-gnu)

So it must be in the last week.
Comment 3 H.J. Lu 2010-06-28 00:21:54 UTC
It is caused by revision 161382:

http://gcc.gnu.org/ml/gcc-cvs/2010-06/msg01300.html
Comment 4 John Regehr 2010-06-28 05:55:00 UTC
This same ICE also happens w/o -fprofile-generate:

regehr@john-home:~/volatile/bugs/tmp318$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r161425-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r161425-install --program-prefix=r161425- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20100626 (experimental) (GCC) 
regehr@john-home:~/volatile/bugs/tmp318$ current-gcc -O2 small.c
small.c: In function ‘func_72’:
small.c:24:1: internal compiler error: in tree_nrv, at tree-nrv.c:155
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
regehr@john-home:~/volatile/bugs/tmp318$ cat small.c
typedef int int32_t;
typedef unsigned char uint8_t;
struct S0
{
  uint8_t f0;
};
struct S0 *g_18[7][5][1][1] = {
};

struct S0 **g_17 = &g_18[0][3][0][0];
int32_t g_86;
struct S0 func_72 (uint8_t p_73, struct S0 p_74);

void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69,
        struct S0 *p_70)
{
  struct S0 l_95 = {
    -1L
  };
  func_72 (1L, func_72 (0, l_95));
}

struct S0
func_72 (uint8_t p_73, struct S0 p_74)
{
  int32_t *l_85 = &g_86;
  if (*l_85)
  lbl_94:*l_85 ^= 0;
  if (g_86)
    goto lbl_94;
  return **g_17;
}
Comment 5 Jan Hubicka 2010-06-28 15:51:41 UTC
Subject: Bug 44687

Author: hubicka
Date: Mon Jun 28 15:51:25 2010
New Revision: 161500

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161500
Log:

	PR tree-optimization/44687
	* gcc.c-torture/compile/pr44687.c
	PR tree-optimization/44687
	* ipa-split.c (split_function): Use DECL_RESULT to store return value.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr44687.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-split.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Jakub Jelinek 2010-07-02 13:22:31 UTC
Fixed.