This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] PR20161
- From: Steven Bosscher <stevenb at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Jul 2005 11:14:46 +0200
- Subject: [patch] PR20161
Hi,
This PR is an ICE-on-invalid code, and a regression in CVS HEAD and 4.0:
struct XX;
typedef void *(*F) (struct XX []);
gb.c:3: error: array type has incomplete element type
gb.c:3: internal compiler error: in gen_formal_parameter_die, at dwarf2out.c:11062
The proposed fix is to do what rest_of_type_compilation already does:
Do not emit debug info if errors were encountered.
Bootstrapped and tested on i686-pc-linux-gnu. OK for mainline and 4.0?
Gr.
Steven
* passes.c (rest_of_decl_compilation): If decl is a type and
we have encountered errors, don't emit debug information.
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.105
diff -u -3 -p -r2.105 passes.c
--- passes.c 19 Jul 2005 18:45:56 -0000 2.105
+++ passes.c 26 Jul 2005 10:12:55 -0000
@@ -175,7 +175,10 @@ rest_of_decl_compilation (tree decl,
timevar_pop (TV_VARCONST);
}
- else if (TREE_CODE (decl) == TYPE_DECL)
+ else if (TREE_CODE (decl) == TYPE_DECL
+ /* Like in rest_of_type_compilation, avoid confusing the debug
+ information machinery when there are errors. */
+ && !(sorrycount || errorcount))
{
timevar_push (TV_SYMOUT);
debug_hooks->type_decl (decl, !top_level);