Bug 22204 - [4.0/4.1 Regression] [repo] internal compiler error: Segmentation fault
Summary: [4.0/4.1 Regression] [repo] internal compiler error: Segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
: 23388 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-27 19:21 UTC by David Cheng
Modified: 2005-08-14 19:22 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work: 3.4.0 3.3.3
Known to fail: 4.0.0 4.1.0
Last reconfirmed: 2005-06-27 20:22:05


Attachments
information specified in the bug reporting instructions (135.97 KB, application/octet-stream)
2005-06-27 19:24 UTC, David Cheng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Cheng 2005-06-27 19:21:37 UTC
Please see attached file for information specified in the bug reporting instructions
Comment 1 David Cheng 2005-06-27 19:24:03 UTC
Created attachment 9161 [details]
information specified in the bug reporting instructions
Comment 2 Andrew Pinski 2005-06-27 20:22:05 UTC
Reduced testcase:
#include <typeinfo>

template<int>
struct function1
{
  function1(void (*f)(void))
  {
     typeid(int (*)(char&));
  }
};
void inputclassifier(void){}
function1<1> b(inputclassifier) ;


----
-frepo is only needed to reproduce this.
This has been failing since at least "3.5.0 20040909".
Comment 3 Andrew Pinski 2005-06-27 20:28:15 UTC
we get this ICE:
t.cc:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

And the backtrace:
#0  0x08134f2e in repo_emit_p (decl=0xb7cc257c) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/
cp/repo.c:288
#1  0x080ca298 in import_export_decl (decl=0xb7cc257c) at /home/peshtigo/pinskia/src/gnu/gcc/
src/gcc/cp/decl2.c:1726
#2  0x080f3e30 in emit_tinfo_decl (decl=0xb7cc257c) at /home/peshtigo/pinskia/src/gnu/gcc/src/
gcc/cp/rtti.c:1465
#3  0x080cdc95 in cp_finish_file () at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/cp/decl2.c:2883
#4  0x08184b0f in c_common_parse_file (set_yydebug=0) at /home/peshtigo/pinskia/src/gnu/gcc/
src/gcc/c-opts.c:1119
#5  0x08493b15 in toplev_main (argc=0, argv=0xbff1a054) at /home/peshtigo/pinskia/src/gnu/gcc/
src/gcc/toplev.c:966
#6  0x003e7ad4 in __libc_start_main () from /lib/tls/libc.so.6
#7  0x08049b21 in _start ()


287           if (!DECL_TEMPLATE_INSTANTIATION (decl)
288               && !CLASSTYPE_TEMPLATE_INSTANTIATION (type)) <--- here

The type which is crashing on (it is not a template at all but a pointer to a function type):
(gdb) p debug_generic_expr (type)
intD.2 (*<T380>) (void)
 <pointer_type 0xb7d4fa8c
    type <function_type 0xb7cb1c3c
        type <integer_type 0xb7ca057c int public type_6 SI
            size <integer_cst 0xb7c983f0 constant invariant 32>
            unit size <integer_cst 0xb7c98180 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7c983a8 -2147483648> max 
<integer_cst 0xb7c983c0 2147483647>
            pointer_to_this <pointer_type 0xb7cafdec>>
        QI
        size <integer_cst 0xb7c981f8 constant invariant 8>
        unit size <integer_cst 0xb7c98210 constant invariant 1>
        align 8 symtab 0 alias set -1
        arg-types <tree_list 0xb7c98c48 value <void_type 0xb7caf9b4 void>>
        pointer_to_this <pointer_type 0xb7d4fa8c>>
    unsigned SI size <integer_cst 0xb7c983f0 32> unit size <integer_cst 0xb7c98180 4>
    align 32 symtab 0 alias set -1>
Comment 4 Andrew Pinski 2005-06-27 20:30:25 UTC
And another testcase, this time with an array:
#include <typeinfo>
template<int>
struct function1
{
  function1()
  {
     typeid(int[100]);
  }
};
function1<1> b;
Comment 5 GCC Commits 2005-07-16 00:25:12 UTC
Subject: Bug 22204

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-07-16 00:25:01

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog repo.c 
Added files:
	gcc/testsuite/g++.dg/rtti: repo1.C 

Log message:
	PR c++/22204
	* repo.c (repo_emit_p): Robustify.
	
	PR c++/22204
	* g++.dg/rtti/repo1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5773&r2=1.5774
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/rtti/repo1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4821&r2=1.4822
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/repo.c.diff?cvsroot=gcc&r1=1.58&r2=1.59

Comment 7 Mark Mitchell 2005-07-16 01:13:51 UTC
Fixed in 4.0.2.
Comment 8 Andrew Pinski 2005-08-14 19:22:33 UTC
*** Bug 23388 has been marked as a duplicate of this bug. ***