werner@dig:~$ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10) I currently use the latest Debian unstable system. werner@dig~$ g++ -O3 -g crasher.cpp crasher.cpp: In function 'float betai(float, float, float)': crasher.cpp:43: internal compiler error: in add_AT_specification, at dwarf2out.c:5048 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>. Preprocessed source stored into /tmp/ccH8vLQj.out file, please attach this to your bugreport. the preprocessed source will be attached.
Created attachment 12057 [details] The preprocessed source
The bug does not occur without the -g option.
Fails with 4.0 and 4.1, works with 3.4 and 4.2.
{ __inline double fabs (double __x) throw () { } typedef struct { } *__locale_t; extern void exit (int __status) throw () __attribute__ ((__noreturn__)); } void nrerror (char error_text[]) { exit (1); } float betacf (float a, float b, float x) { void nrerror (char error_text[]); float aa, c, d, del, h, qab, qam, qap; d = 1.0 - qab * x / qap; if (fabs (d) < 1.0e-30) h = d; { if (fabs (d) < 1.0e-30) d = 1.0e-30; } return h; } float betai (float a, float b, float x) { void nrerror (char error_text[]); nrerror ("Bad x in routine betai"); }
Further reduced: double fabs (double __x) { } extern void exit (int __status); void nrerror (void) { exit(0); } float betacf (float x) { void nrerror (void); float d, h; d = 1.0 - x; if (fabs (d) < 1.0e-30) h = d; return h; } void betai (void) { void nrerror (void); nrerror (); }
I bet this was fixed by the patch which fixed PR 26757 finnally (comment #28).
(In reply to comment #6) > I bet this was fixed by the patch which fixed PR 26757 finnally (comment #28). I can confirm this.
(In reply to comment #7) > (In reply to comment #6) > > I bet this was fixed by the patch which fixed PR 26757 finnally (comment #28). > > I can confirm this. Jakub, can you apply your patch for PR 26757 to 4.0 and 4.1?
In case Jakub's patch can't be backported easily, this might be useful. A regression hunt on powerpc-linux identified the following patch as the start of failures for the testcase in comment #5: http://gcc.gnu.org/viewcvs?view=rev&rev=83405 r83405 | zack | 2004-06-20 08:34:54 +0000 (Sun, 20 Jun 2004)
(In reply to comment #9) > http://gcc.gnu.org/viewcvs?view=rev&rev=83405 Not really, it was this part that caused it: * name-lookup.c (pushdecl): When a local extern shadows a file-scope declaration of the same object, give both DECLs the same DECL_UID. Which I was semi expecting. And this is related to PR 16792.
Created attachment 12071 [details] gcc41-pr27793.patch It certainly can be backported easily, I'm using this patch on top of redhat/gcc-4_1-branch for 2 months already, in the mean time recompiled the whole distribution with it etc. Not sure about 4.0 branch though. I'll bootstrap/regression test this on vanilla gcc-4_1-branch and post for approval.
Subject: Bug 28677 Author: jakub Date: Sun Aug 13 20:26:38 2006 New Revision: 116115 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116115 Log: 2006-08-13 Andrew MacLeod <amacleod@redhat.com> PR middle-end/27793 * tree-dfa.c (add_referenced_var): Assert DECL_UID is unique for different decls. 2006-08-13 Jakub Jelinek <jakub@redhat.com> PR c++/28677 PR middle-end/27793 * cp-tree.h (cxx_int_tree_map): New struct. (struct language_function): Add extern_decl_map field. * name-lookup.c (pushdecl_maybe_friend): Add x -> t mapping to cp_function_chain->extern_decl_map hash table instead of copying over DECL_UID. * cp-gimplify.c (cxx_int_tree_map_eq, cxx_int_tree_map_hash): New functions. (cp_genericize_r): Remap DECL_EXTERN local decls using cp_function_chain->extern_decl_map hash table. * decl.c (finish_function): Clear extern_decl_map. Revert: 2006-06-06 Andrew MacLeod <amacleod@redhat.com> PR middle-end/27793 * tree-dfa.c (referenced_vars_dup_list): New. List of duplicate referenced_variables with matching DECL_UID's. (find_referenced_vars): Make sure duplicate list is empty to start. (add_referenced_var): Add var to duplicate list if required. * tree-ssa.c (delete_tree_ssa): Clear var_ann's on duplicates. * tree-flow.h (referenced_vars_dup_list): External declaration. PR c++/26757 PR c++/27894 * g++.dg/tree-ssa/pr26757.C: New test. * g++.dg/tree-ssa/pr27894.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr26757.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr27894.C Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/cp-gimplify.c branches/gcc-4_1-branch/gcc/cp/cp-tree.h branches/gcc-4_1-branch/gcc/cp/decl.c branches/gcc-4_1-branch/gcc/cp/name-lookup.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/tree-dfa.c branches/gcc-4_1-branch/gcc/tree-flow.h branches/gcc-4_1-branch/gcc/tree-ssa.c
Fixed in 4.0.4.
(In reply to comment #13) > Fixed in 4.0.4. I mean 4.1.2.
Fixed in GCC-4.1.2.