Bug 15736

Summary: [4.0 Regression] internal compiler error: in force_decl_die, at dwarf2out.c:12441
Product: gcc Reporter: Carlo Wood <carlo>
Component: debugAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: critical CC: dpatel, gcc-bugs, reichelt
Priority: P2 Keywords: ice-on-valid-code, monitored
Version: 4.0.0   
Target Milestone: 4.0.0   
Host: Target:
Build: Known to work: 3.4.0
Known to fail: 4.0.0 Last reconfirmed: 2004-05-30 19:46:08

Description Carlo Wood 2004-05-30 19:44:05 UTC
This bug, or rather a very similar one was fixed not long ago.
But it appears still to exist in todays compiler :/

To reproduce compile this:

class sbll_node_ct;

class sbll_base_ct {
protected:
  sbll_base_ct(void) { }
  ~sbll_base_ct(void) { }
  class sbll_node_ct* next;
};

class sbll_list_ct: private sbll_base_ct {
protected:
  using sbll_base_ct::next;
};


by doing:

>g++-cvs-3.5 -c -g test.cc
test.cc:12: internal compiler error: in force_decl_die, at dwarf2out.c:12441
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

This is with

>g++-cvs-3.5 -v
Reading specs from /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.5.0/specs
Configured with: /usr/src/gcc/gcc-cvs-3.5/configure
--prefix=/usr/local/gcc-cvs-3.5 --enable-shared --with-gnu-as --with-gnu-ld
--enable-languages=c++ --enable-debug --enable-threads=posix --disable-checking
--with-system-zlib --enable-__cxa_atexit --host=i686-redhat-linux
Thread model: posix
gcc version 3.5.0 20040530 (experimental)
Comment 1 Andrew Pinski 2004-05-30 19:46:08 UTC
Confirmed.
Comment 2 Carlo Wood 2004-05-30 19:52:27 UTC
A slightly simpler test case:


struct B {
  int n;
};

struct A : B {
  using B::n;
};

Comment 3 Andrew Pinski 2004-06-17 10:06:21 UTC
Devang Patel, can you look into this as I think this is caused by your patch:
2004-01-27  Devang Patel <dpatel@apple.com>

        * Makefile.in (dwarf2out.o): Depend on input.h
        * dbxout.c (dbx_debug_hooks): Add new empty hook for
        imported_module_or_decl.
        (xcoff_debug_hooks): Same.
        * sdbout.c (sdb_debug_hooks): Same.
        * vmsdbgout.c (vmsdbg_debug_hooks): Same.
        * debug.c (do_nothing_debug_hooks): Same.
        (debug_nothing_tree_tree): New function.
        * debug.h (gcc_debug_hooks): New hook, imported_module_or_decl.
        * dwarf2out.c: Include input.h.
        (dwarf2_debug_hooks): Add new hook for imported_module_or_decl.
        (remove_child_TAG): New function.
        (dwarf_tag_name): Handle DW_TAG_imported_module.
        (gen_subprogram_die): Equate decl number to declaration die. Do not
        remove all children dies while reusing declaration die for definition.
        Instead, selectively remove only formal parameters.
        (gen_variable_die): Equate variable decl to declaration die.
        (gen_field_die): Equate field decl to line number.
        (force_namespace_die): Replace it with ...
        (force_decl_die): ... this.
        (force_type_die): New function.
        (setup_namespace_context): Replace use of force_namespace_die() with
        force_decl_die().
        (gen_namespace_die): Same.
        (dwarf2out_imported_module_or_decl): New function.
Comment 4 Devang Patel 2004-06-19 19:29:47 UTC
If following patch is reverted than it fixes this ICE.
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15736

But that patch was applied to fix Ada bootstrap. Andrew, do you have Ada setup to see if this patches 
still causes trouble with Ada?

Thanks.
Comment 5 Devang Patel 2004-06-19 19:31:20 UTC
Oops.  I meant following patch

http://gcc.gnu.org/ml/gcc-cvs/2004-01/msg01520.html
Comment 6 Andrew Pinski 2004-06-19 19:33:18 UTC
Subject: Re:  [3.5 Regression] internal compiler error: in force_decl_die, at dwarf2out.c:12441

> 
> 
> ------- Additional Comments From dpatel at apple dot com  2004-06-19 19:29 -------
> If following patch is reverted than it fixes this ICE.
>   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15736
> 
> But that patch was applied to fix Ada bootstrap. Andrew, do you have Ada setup to see if this patches 
> still causes trouble with Ada?

Which patch, you only gave a link to this bug again?  Also Ada is broken on the mainline because of
the tree-ssa merge so I cannot test Ada :(.

Thanks,
Andrew

Comment 7 Andrew Pinski 2004-09-03 17:20:32 UTC
Fixed by:
        * dwarf2out.c (gen_field_die): Equate decl number to die.
        * g++.dg/debug/pr15736.cc: New test.
Comment 8 GCC Commits 2024-11-01 00:18:20 UTC
The master branch has been updated by Sam James <sjames@gcc.gnu.org>:

https://gcc.gnu.org/g:a287ff2697f0788856a21c99098611a5ae0a4749

commit r15-4827-ga287ff2697f0788856a21c99098611a5ae0a4749
Author: Sam James <sam@gentoo.org>
Date:   Tue Oct 29 06:00:08 2024 +0000

    testsuite: g++.dg: debug: fix test filenames
    
    gcc/testsuite/ChangeLog:
            PR debug/15736
            PR debug/46240
    
            * g++.dg/debug/pr15736.cc: Move to...
            * g++.dg/debug/pr15736.C: ...here.
            * g++.dg/debug/pr46240.cc: Move to...
            * g++.dg/debug/pr46240.C: ...here.
Comment 9 Carlo Wood 2024-11-02 13:37:41 UTC
Just curious... what caused the 20 years of delay?
Comment 10 Andrew Pinski 2024-11-02 15:17:04 UTC
(In reply to Carlo Wood from comment #9)
> Just curious... what caused the 20 years of delay?

Sam has been auditing the testsuite to find issues like a missnamed testcase (like in this case). So the testcase was not running before but is now since he renamed it. He put the PR # in the changelog so it got into bugzilla to record a related change.