First of all the typescript: ############################################## stan@vaxatron:~/wtmp> cat gb.c struct XX; typedef void *(*F) (struct XX []); stan@vaxatron:~/wtmp> CVSgcc gb.c -Wall -g 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 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. stan@vaxatron:~/wtmp> CVSgcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/home/stan/GCC/gcc-4.0-20050220/bin --program-prefix=CVS : (reconfigured) ../configure --prefix=/home/stan/GCC/gcc-4.0-20050220/bin --program-prefix=CVS Thread model: posix gcc version 4.0.0 20050220 (experimental) ###################################################### Except from the internal compiler error, is it a bug that gcc considers the incomplete type an error? If yes, then this is even more critical. In 3.4 and 3.2 the above code was Ok.
The code is invalid as mentioned before in other bugs. Confirmed, a regression.
Created attachment 8277 [details] * dwarf2out.c (gen_formal_types_die): Robustify. I'll test this a bit and post it if it looks OK.
PalmSource bug 105106. Happens on code which is supposedly valid, but I haven't verified that.
Let's try this patch then. 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);
Subject: Bug 20161 CVSROOT: /cvs/gcc Module name: gcc Changes by: steven@gcc.gnu.org 2005-07-28 01:24:20 Modified files: gcc : ChangeLog passes.c Log message: PR debug/20161 * passes.c (rest_of_decl_compilation): If decl is a type and we have encountered errors, don't emit debug information. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9572&r2=2.9573 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/passes.c.diff?cvsroot=gcc&r1=2.105&r2=2.106
be fixeth, buglette!
Subject: Bug 20161 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: steven@gcc.gnu.org 2005-07-28 01:28:59 Modified files: gcc : passes.c ChangeLog Log message: PR debug/20161 * passes.c (rest_of_decl_compilation): If decl is a type and we have encountered errors, don't emit debug information. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/passes.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.72.2.2&r2=2.72.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.334&r2=2.7592.2.335
The patch looks good on the first of our files to elicit this bug. The following line causes the ICE; the line after does not. /opt2/gcc401-chkall-9330/bin/g++ -g ../cpp/bugfiles/GCC_bugfiles/error/105106_jdinput.c /opt2/gcc401-chkall-8277-9330/bin/g++ -g ../cpp/bugfiles/GCC_bugfiles/error/105106_jdinput.c I'll crash test the checking=yes version overnight. (Note that so far I'm only crash-testing; I'm not yet doing correctness testing.)
The patch looked good in overnight crash-testing over five thousand files in our source tree. I used checking=yes version with patches 8277 and 9330. I'm afraid last night's results aren't directly comparable to my last run with an unpatched g++, but the internal errors were a small subset of the unpatched version, 4 vs 30. (Two of those four were bug 23125, one was 23089, and I'll file the other one.)