Bug 36278 - [4.2/4.3/4.4 Regression] ICE with typedef void in namespace and using the defined type in another when compiling with "-g"
[4.2/4.3/4.4 Regression] ICE with typedef void in namespace and using the def...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: debug
4.3.0
: P2 normal
: 4.3.2
Assigned To: Jakub Jelinek
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-20 13:32 UTC by Tiziano Müller
Modified: 2009-04-29 15:14 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.2.3 4.3.0 4.4.0
Last reconfirmed: 2008-07-30 11:41:05


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tiziano Müller 2008-05-20 13:32:09 UTC
The code snippet goes as follows:

*snip*
namespace Bar
{
        typedef void MyVoid;
}
using Bar::MyVoid;
*snip*

Compiling with "g++-4.3.0 -save-temps -g -Wall -o simple simple.cc -c"
results in this:

simple.cc:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.

Could reproduce this bug on Gentoo 2008.0 with g++ 4.3.0 and 4.2.3 and on Fedora Core 8.
Comment 1 Andrew Pinski 2008-05-20 13:36:54 UTC
Works for me with the trunk on both i686-linux-gnu and i386-apple-darwin.  Also works with "4.3.0 20070729" and 4.3.0 20080128 on i386-apple-darwin.
Comment 2 Richard Biener 2008-05-20 13:44:25 UTC
Confirmed.  -g is the key.

Program received signal SIGSEGV, Segmentation fault.
0x000000000081eed9 in prune_unused_types_mark (die=0x0, dokids=1)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:14913
14913     if (die->die_mark == 0)
Comment 3 Jakub Jelinek 2008-07-31 08:02:48 UTC
Subject: Bug 36278

Author: jakub
Date: Thu Jul 31 08:01:25 2008
New Revision: 138361

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138361
Log:
	PR debug/36278
	* dwarf2out.c (get_context_die): New function.
	(force_decl_die, force_type_die): Use it.
	(dwarf2out_imported_module_or_decl): Likewise.  If base_type_die
	returns NULL, force generation of DW_TAG_typedef and put that into
	DW_AT_import.

	* g++.dg/debug/namespace2.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/debug/namespace2.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2008-07-31 08:49:50 UTC
Subject: Bug 36278

Author: jakub
Date: Thu Jul 31 08:48:26 2008
New Revision: 138369

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138369
Log:
	PR debug/36278
	* dwarf2out.c (get_context_die): New function.
	(force_decl_die, force_type_die): Use it.
	(dwarf2out_imported_module_or_decl): Likewise.  If base_type_die
	returns NULL, force generation of DW_TAG_typedef and put that into
	DW_AT_import.

	* g++.dg/debug/namespace2.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/debug/namespace2.C
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/dwarf2out.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2008-07-31 08:51:46 UTC
Fixed.