From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28114 invoked by alias); 20 Feb 2003 17:16:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 28086 invoked by uid 71); 20 Feb 2003 17:16:01 -0000 Resent-Date: 20 Feb 2003 17:16:01 -0000 Resent-Message-ID: <20030220171601.28085.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, bangerth@ticam.utexas.edu Received: (qmail 26336 invoked by uid 48); 20 Feb 2003 17:14:29 -0000 Message-Id: <20030220171429.26335.qmail@sources.redhat.com> Date: Thu, 20 Feb 2003 17:16:00 -0000 From: bangerth@ticam.utexas.edu Reply-To: bangerth@ticam.utexas.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg X-SW-Source: 2003-02/txt/msg01001.txt.bz2 List-Id: >Number: 9778 >Category: c++ >Synopsis: [3.4 regression] ICE with sizeof(expr) in non-type template arg >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Feb 20 17:16:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Wolfgang Bangerth >Release: unknown-1.0 >Organization: >Environment: present mainline >Description: This started SegFaulting somewhere between 2003-01-12 and 2003-01-30: ------------------------------- namespace NS { template void foo (); } template struct X { int m; int g () { NS::foo(); } }; template class X<2>; -------------------------- g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc y.cc: In member function `int X::g() [with int N = 2]': y.cc:12: instantiated from here y.cc:8: internal compiler error: Segmentation fault Here's a backtrace: #0 0x4009db33 in strlen () from /lib/libc.so.6 #1 0x08146004 in write_expression (expr=0x4015dfa0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1985 #2 0x0814659f in write_expression (expr=0x4015dfa0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:2017 #3 0x0814659f in write_expression (expr=0x401965f0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:2017 #4 0x08146dae in write_template_arg (node=0x401965f0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:2133 #5 0x08145dae in write_template_args (args=0x40196690) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1812 #6 0x08143792 in write_nested_name (decl=0x4019857c) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:841 #7 0x08143361 in write_name (decl=0x4019857c, ignore_local_scope=0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:763 The place where this happens is incidentally the same as that noted in PR 9749, though that is a regression introduced long ago. Maybe somewhen in the time frame noted above some code path just started to use the same path as that in 9749. If so, then one should be able to squash both bugs with one patch. The underlying problem is the following: we segfault in strlen called from write_expression in this hunk: /* If it wasn't any of those, recursively expand the expression. */ write_string (operator_name_info[(int) code].mangled_name); In the testcase (gdb) fr 1 #1 0x08146004 in write_expression (expr=0x4015dfa0) at ../../gcc-3.4-CVS/gcc/cp/mangle.c:1985 (gdb) p code $5 = IDENTIFIER_NODE (gdb) p (int)code $6 = 1 (gdb) p operator_name_info[1] $7 = {identifier = 0x0, name = 0x0, mangled_name = 0x0, arity = 0} W. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: