public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type
@ 2004-11-18 16:03 reichelt at gcc dot gnu dot org
2004-11-18 16:06 ` [Bug c++/18545] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-18 16:03 UTC (permalink / raw)
To: gcc-bugs
The following invalid code snippet crashes the C++ frontend:
===================================================
struct A;
A foo()
{
A a;
return a;
}
===================================================
bug.cc: In function 'A foo()':
bug.cc:7: error: return type 'struct A' is incomplete
bug.cc:9: error: aggregate 'A a' has incomplete type and cannot be defined
bug.cc:10: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in check_return_expr, at cp/typeck.c:6296
Please submit a full bug report, [etc.]
The bug is present since gcc 3.4.0.
Looks like it was introduced with the new parser:
: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk (#160).
--
Summary: [3.4/4.0 regression] ICE when returning undefined type
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, error-recovery, monitored
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4/4.0 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
@ 2004-11-18 16:06 ` pinskia at gcc dot gnu dot org
2004-11-25 2:39 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-18 16:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-18 16:06 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-11-18 16:06:02
date| |
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4/4.0 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
2004-11-18 16:06 ` [Bug c++/18545] " pinskia at gcc dot gnu dot org
@ 2004-11-25 2:39 ` mmitchel at gcc dot gnu dot org
2004-11-25 2:42 ` reichelt at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-25 2:39 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4/4.0 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
2004-11-18 16:06 ` [Bug c++/18545] " pinskia at gcc dot gnu dot org
2004-11-25 2:39 ` mmitchel at gcc dot gnu dot org
@ 2004-11-25 2:42 ` reichelt at gcc dot gnu dot org
2004-11-25 2:45 ` mark at codesourcery dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-25 2:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-11-25 02:42 -------
Mark, it looks like the following patch fixes the problem.
Index: typeck.c
===================================================================
RCS file: /home/reichelt/GCC/CVS/gcc-cvs/gcc/gcc/cp/typeck.c,v
retrieving revision 1.597
diff -u -p -r1.597 typeck.c
--- typeck.c 22 Nov 2004 12:15:36 -0000 1.597
+++ typeck.c 25 Nov 2004 01:41:11 -0000
@@ -6287,6 +6287,7 @@ check_return_expr (tree retval)
if (fn_returns_value_p && flag_elide_constructors)
{
if (retval != NULL_TREE
+ && TREE_TYPE (retval) != error_mark_node
&& (current_function_return_value == NULL_TREE
|| current_function_return_value == retval)
&& TREE_CODE (retval) == VAR_DECL
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4/4.0 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-25 2:42 ` reichelt at gcc dot gnu dot org
@ 2004-11-25 2:45 ` mark at codesourcery dot com
2004-11-25 17:13 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mark at codesourcery dot com @ 2004-11-25 2:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mark at codesourcery dot com 2004-11-25 02:45 -------
Subject: Re: [3.4/4.0 regression] ICE when returning undefined
type
reichelt at gcc dot gnu dot org wrote:
> ------- Additional Comments From reichelt at gcc dot gnu dot org 2004-11-25 02:42 -------
> Mark, it looks like the following patch fixes the problem.
Thanks; I've already got a slightly cleaner version.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4/4.0 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-25 2:45 ` mark at codesourcery dot com
@ 2004-11-25 17:13 ` cvs-commit at gcc dot gnu dot org
2004-11-25 17:43 ` [Bug c++/18545] [3.4 " mmitchel at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-25 17:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-25 17:12 -------
Subject: Bug 18545
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2004-11-25 17:11:37
Modified files:
gcc : ChangeLog c-common.c c-common.h c-typeck.c
toplev.c
gcc/testsuite : ChangeLog
gcc/testsuite/g++.dg/expr: unary2.C
gcc/testsuite/g++.dg/ext: lvaddr.C
gcc/testsuite/g++.dg/opt: pr7503-3.C
gcc/testsuite/g++.old-deja/g++.other: friend7.C
gcc/cp : ChangeLog class.c cp-tree.h decl.c
name-lookup.c pt.c tree.c typeck.c
Added files:
gcc/testsuite/g++.dg/template: crash28.C
gcc/testsuite/g++.dg/expr: return1.C
gcc/testsuite/g++.dg/parse: qualified3.C
Log message:
PR c++/18001
* c-common.h (lvalue_use): Move here from c-ctypeck.c.
(lvalue_or_else): Declare.
* c-common.c (lvalue_or_else): Move here from c-typeck.c.
* c-typeck.c (lvalue_use): Remove.
(lvalue_or_else): Remove.
PR c++/18556
* toplev.c (check_global_declarations): Set DECL_IGNORED_P on
unemitted variables with static storage duration.
PR c++/18445
* class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with
unknown_type as non matching. Tidy up.
* pt.c (build_non_dependent_expr): Do not build a
NON_DEPENDENT_EXPR for a VAR_DECL.
PR c++/18001
* cp-tree.h (lvalue_or_else): Remove declaration.
* tree.c (lvalue_or_else): Remove.
* typeck.c (build_unary_op): Adjust call to lvalue_or_else.
(build_modify_expr): Likewise.
PR c++/18625
* decl.c (duplicate_decls): Return error_mark_node on error, as
specified.
PR c++/18466
* decl.c (grokvardecl): Keep track of whether or not a there was
explicit qualification.
* name-lookup.c (set_decl_namespace): Complain about explicit
qualification of a name within its own namespace.
PR c++/18545
* typeck.c (check_return_expr): Robustify.
PR c++/18445
* g++.dg/template/crash28.C: Likewise.
PR c++/18001
* g++.dg/expr/unary2.C: Adjust lvalue messages.
* g++.dg/ext/lvaddr.C: Likewise.
* g++.dg/opt/pr7503-3.C: Likewise.
PR c++/18466
* g++.dg/parse/qualified3.C: New test.
* g++.old-deja/g++.other/friend7.C: Remove bogus qualification.
PR c++/18545
* g++.dg/expr/return1.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6549&r2=2.6550
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.587&r2=1.588
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.271&r2=1.272
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.400&r2=1.401
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.932&r2=1.933
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4648&r2=1.4649
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash28.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/return1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/unary2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/lvaddr.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr7503-3.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/qualified3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/friend7.C.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4498&r2=1.4499
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.689&r2=1.690
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1073&r2=1.1074
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1333&r2=1.1334
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.95&r2=1.96
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.948&r2=1.949
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.419&r2=1.420
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.598&r2=1.599
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-11-25 17:13 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-25 17:43 ` mmitchel at gcc dot gnu dot org
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-25 17:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-11-25 17:42 -------
Fixed in 4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.4/4.0 regression] ICE |[3.4 regression] ICE when
|when returning undefined |returning undefined type
|type |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-11-25 17:43 ` [Bug c++/18545] [3.4 " mmitchel at gcc dot gnu dot org
@ 2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
2005-09-01 14:57 ` reichelt at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:25 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.4 |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
@ 2005-09-01 14:57 ` reichelt at gcc dot gnu dot org
2005-09-01 15:06 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:08 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-01 14:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-09-01 14:57 -------
Taking care of the backport to the 3.4 branch.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|mark at codesourcery dot com|reichelt at gcc dot gnu dot
| |org
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2005-
| |09/msg00031.html
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-09-01 14:57 ` reichelt at gcc dot gnu dot org
@ 2005-09-01 15:06 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:08 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-01 15:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-01 15:06 -------
Subject: Bug 18545
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: reichelt@gcc.gnu.org 2005-09-01 15:06:17
Modified files:
gcc/cp : ChangeLog typeck.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/expr: return1.C
Log message:
Backport:
2004-11-25 Mark Mitchell <mark@codesourcery.com>
PR c++/18545
* typeck.c (check_return_expr): Robustify.
* g++.dg/expr/return1.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.233&r2=1.3892.2.234
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.29&r2=1.519.2.30
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.424&r2=1.3389.2.425
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/return1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.46.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18545] [3.4 regression] ICE when returning undefined type
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-09-01 15:06 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-01 15:08 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-01 15:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-09-01 15:07 -------
Fixed also on the 3.4 branch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18545
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-09-01 15:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-18 16:03 [Bug c++/18545] New: [3.4/4.0 regression] ICE when returning undefined type reichelt at gcc dot gnu dot org
2004-11-18 16:06 ` [Bug c++/18545] " pinskia at gcc dot gnu dot org
2004-11-25 2:39 ` mmitchel at gcc dot gnu dot org
2004-11-25 2:42 ` reichelt at gcc dot gnu dot org
2004-11-25 2:45 ` mark at codesourcery dot com
2004-11-25 17:13 ` cvs-commit at gcc dot gnu dot org
2004-11-25 17:43 ` [Bug c++/18545] [3.4 " mmitchel at gcc dot gnu dot org
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
2005-09-01 14:57 ` reichelt at gcc dot gnu dot org
2005-09-01 15:06 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:08 ` reichelt at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).