This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25301] [3.4 regression] ICE for sizofe of incomplete type
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Dec 2005 20:40:34 -0000
- Subject: [Bug c/25301] [3.4 regression] ICE for sizofe of incomplete type
- References: <bug-25301-1771@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from gdr at integrable-solutions dot net 2005-12-07 20:40 -------
Subject: Re: New: [3.4 regression] ICE for sizofe of incomplete type
"reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| The testcase gcc.dg/noncompile/920923-1.c causes an ICE on the 3.4 branch.
| A reduced testcase is:
|
| =======================
| typedef struct A B;
| int i = sizeof(B);
| =======================
|
| bug.c:2: error: invalid application of `sizeof' to incomplete type `
| Internal compiler error: Error reporting routines re-entered.
| Please submit a full bug report, [etc.]
|
| The culprit is the code in c-objc-common.c (c_tree_printer) <case 'T'>:
|
| case 'T':
| if (TREE_CODE (t) == TYPE_DECL)
| {
| if (DECL_NAME (t))
| n = (*lang_hooks.decl_printable_name) (t, 2);
| }
| else
| {
| t = TYPE_NAME (t);
| if (t)
| n = IDENTIFIER_POINTER (t);
| }
| break;
|
| In the above case t is a RECORD_TYPE, but TYPE_NAME (t) is a TYPE_DECL.
| So there's some logic missing to handle this case.
In general, there is a "type" problem in both C and C++ front ends.
The documentation for TYPE_NAME says that it returns a TYPE_DECL -- as
opposed to an IDENTIFIER_NODE. However, at various occasions I found
that a TYPE_NAME would return an IDENTIFIER_NODE. That is a clear bug
in both front ends ans should be hunt. Obviously, you have identified a
place where instead of correcting the problem the pretty-printer had
assumed that TYPE_NAME will always return an IDENTIFIER_NODE --
despite the documentation. I believe a proper PR should be filled so
that both front ends are cured from that confusion.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301