Bug 27830 - [4.1 regression] ICE: verify_stmts failed (invalid operand to unary operator)
Summary: [4.1 regression] ICE: verify_stmts failed (invalid operand to unary operator)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P1 normal
Target Milestone: 4.1.2
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-05-31 07:12 UTC by Martin Michlmayr
Modified: 2006-06-16 12:07 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.0 4.2.0 3.4.0
Known to fail: 4.1.2
Last reconfirmed: 2006-06-07 20:37:18


Attachments
test case (594 bytes, text/plain)
2006-05-31 07:13 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-05-31 07:12:09 UTC
I get the following ICE with gcc 4.2.  This looks suspiciously a lot like 
PR26994 but the patch suggested there is Fortran specific whereas my test case is C++.  Maybe there is a more fundamental problem somewhere?


(sid)3300:tbm@test: ~/delta/bin] /usr/lib/gcc-snapshot/bin/g++ -c -O mini.c
mini.c: In member function 'camp::drawElement* camp::drawPath::transformed(const camp::transform&)':
mini.c:87: error: invalid operand to unary operator
&*D.2372_31;

mini.c:87: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
zsh: exit 1     /usr/lib/gcc-snapshot/bin/g++ -c -O mini.c
(sid)3301:tbm@test: ~/delta/bin] /usr/lib/gcc-snapshot/bin/g++ -c mini.c
(sid)3302:tbm@test: ~/delta/bin]
Comment 1 Martin Michlmayr 2006-05-31 07:13:45 UTC
Created attachment 11543 [details]
test case
Comment 2 Andrew Pinski 2006-05-31 07:19:03 UTC
This really unrelated to that fortran bug.  Anyways I might take a look soon.
Comment 3 Andrew Pinski 2006-05-31 07:53:03 UTC
Confirmed, reduced testcase:
struct gc{};
struct transform:public gc
{
    double x, y, z, t;
    transform (void){}
};
inline transform f (void)
{
    return transform ();
};
void transformed (void)
{
    new transform (f());
}

------------------------------------------------
This is return slot related and inline related, we have:
  *D.2030 = f () [return slot optimization];
........
  __comp_ctor  (&<retval>);
  return <retval>;
Comment 4 Richard Biener 2006-06-07 14:52:50 UTC
Also fails with 4.1.2.  Janis, can you look what introduced this?
Comment 5 Janis Johnson 2006-06-07 18:23:36 UTC
A regression hunt on powerpc-linux with the testcase in comment #3 identified this mainline patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=112709

    r112709 | rguenth | 2006-04-05 15:41:18 +0000 (Wed, 05 Apr 2006)

The same patch was added to the 4.1 branch a couple of days later, so I assume it's also the cause of the failure there.  GCC 4.1.0 does not fail.
Comment 6 Richard Biener 2006-06-07 19:51:53 UTC
I guess the patch uncovered a latent problem due to different inlining.  I will have a look though.
Comment 7 Richard Biener 2006-06-07 20:37:18 UTC
I have a fix.
Comment 8 patchapp@dberlin.org 2006-06-08 08:26:47 UTC
Subject: Bug number PR27830

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00385.html
Comment 9 Richard Biener 2006-06-13 07:22:14 UTC
Subject: Bug 27830

Author: rguenth
Date: Tue Jun 13 07:22:04 2006
New Revision: 114600

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114600
Log:
2006-06-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/27830
	* tree-inline.c (copy_body_r): For copying the operand
	of an ADDR_EXPR make sure to fold &* afterwards.

	* g++.dg/tree-ssa/pr27830.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr27830.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c

Comment 10 Richard Biener 2006-06-16 12:03:41 UTC
Subject: Bug 27830

Author: rguenth
Date: Fri Jun 16 12:03:24 2006
New Revision: 114716

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114716
Log:
2006-06-16  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/27830
        * tree-inline.c (copy_body_r): For copying the operand
        of an ADDR_EXPR make sure to fold &* afterwards.

        * g++.dg/tree-ssa/pr27830.C: New testcase.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr27830.C
      - copied unchanged from r114600, trunk/gcc/testsuite/g++.dg/tree-ssa/pr27830.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-inline.c

Comment 11 Richard Biener 2006-06-16 12:07:32 UTC
Fixed.