Bug 28238 - [4.1 regression] verify_stmts failed (invalid operand to unary operator)
Summary: [4.1 regression] 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 blocker
Target Milestone: 4.1.2
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-07-03 22:17 UTC by Martin Michlmayr
Modified: 2006-07-24 10:28 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.6 4.0.4 4.1.1 4.2.0
Known to fail: 4.1.2
Last reconfirmed: 2006-07-06 12:38:32


Attachments
test case (774 bytes, text/plain)
2006-07-03 22:18 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-07-03 22:17:30 UTC
I get the following ICE with gcc 4.2.  gcc 4.0 and 4.1 work.

(sid)65:tbm@usurper: ~] /usr/lib/gcc-snapshot/bin/g++ -c -O min4.c
min4.c: In constructor 'ConfLexerCore::ConfLexerCore(ConfIO*)':
min4.c:86: error: invalid operand to unary operator
&thisD.2456_2->m_matchStartD.2447;

min4.c:86: 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 min4.c
(sid)66:tbm@usurper: ~] /usr/lib/gcc-snapshot/bin/g++ -c min4.c
(sid)67:tbm@usurper: ~] g++-4.1 -c -O2 min4.c
(sid)68:tbm@usurper: ~] g++-4.0 -c -O2 min4.c
(sid)69:tbm@usurper: ~] g++-3.4 -c -O2 min4.c
(sid)70:tbm@usurper: ~]
Comment 1 Martin Michlmayr 2006-07-03 22:18:32 UTC
Created attachment 11809 [details]
test case
Comment 2 Andrew Pinski 2006-07-03 23:16:00 UTC
Confirmed.  Reduced testcase:
struct iterator{};
struct ByteIterator : iterator
{
	ByteIterator (){}
	int a[1024];
};
inline ByteIterator f ()
{
	return  ByteIterator ();
}
class ConfLexerCore
{
	ConfLexerCore ();
	ByteIterator m_matchStart;
};
ConfLexerCore::ConfLexerCore ()
: m_matchStart (f ())
{ }
Comment 3 Richard Biener 2006-07-04 13:56:27 UTC
It rejects the valid code and ices during error-recovery.
Comment 4 Richard Biener 2006-07-04 13:58:43 UTC
Ah no, verify_stmts uses error ().
Comment 5 Richard Biener 2006-07-04 14:14:26 UTC
We have

(struct iteratorD.1984 *) &thisD.2040_1->m_matchStartD.2038

after inlining, which is non-gimple.

(gdb) call debug_tree (*tp)
 <nop_expr 0xb7e512e0
    type <pointer_type 0xb7e498fc
        type <record_type 0xb7e49450 iterator type_1 type_5 QI
            size <integer_cst 0xb7d911e0 constant invariant 8>
            unit size <integer_cst 0xb7d911f8 constant invariant 1>
            align 8 symtab 0 alias set -1 fields <type_decl 0xb7e199c0 iterator>
            X() X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown
            pointer_to_this <pointer_type 0xb7e498fc> chain <type_decl 0xb7e19958 iterator>>
        unsigned SI
        size <integer_cst 0xb7d913d8 constant invariant 32>
        unit size <integer_cst 0xb7d91168 constant invariant 4>
        align 32 symtab 0 alias set -1>
    readonly
    arg 0 <addr_expr 0xb7e51300
        type <pointer_type 0xb7e49678 type <record_type 0xb7e49564 ByteIterator>
            public unsigned SI size <integer_cst 0xb7d913d8 32> unit size <integer_cst 0xb7d91168 4>
            align 32 symtab 0 alias set -1>
        arg 0 <component_ref 0xb7e1c7f8 type <record_type 0xb7e49564 ByteIterator>
           
            arg 0 <indirect_ref 0xb7e51320 type <record_type 0xb7e49ebc ConfLexerCore>
               
                arg 0 <ssa_name 0xb7da0540 type <pointer_type 0xb7e4e05c>
                    var <parm_decl 0xb7d9fd70 this> def_stmt <nop_expr 0xb7e51340>
                    version 1>> arg 1 <field_decl 0xb7e4e0b8 m_matchStart>>>>
Comment 6 Richard Biener 2006-07-06 10:55:16 UTC
4.1.2 also fails.
Comment 7 Richard Biener 2006-07-06 12:38:32 UTC
I have a fix.
Comment 8 patchapp@dberlin.org 2006-07-06 14:55:28 UTC
Subject: Bug number PR28238

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-07/msg00226.html
Comment 9 Richard Biener 2006-07-17 08:04:33 UTC
Subject: Bug 28238

Author: rguenth
Date: Mon Jul 17 08:04:25 2006
New Revision: 115517

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

	PR tree-optimization/28238
	* tree-inline.c (copy_bb): Check if we produced valid
	gimple copying and substituting a stmt.  If not, gimplify
	it.

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

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

Comment 10 Richard Biener 2006-07-17 08:05:22 UTC
Fixed on the mainline.
Comment 11 Richard Biener 2006-07-24 10:28:01 UTC
Subject: Bug 28238

Author: rguenth
Date: Mon Jul 24 10:27:53 2006
New Revision: 115711

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

	PR tree-optimization/28238
	* tree-inline.c (copy_bb): Check if we produced valid
	gimple copying and substituting a stmt.  If not, gimplify
	it.

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

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr28238.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 12 Richard Biener 2006-07-24 10:28:12 UTC
Fixed.