public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg
@ 2003-02-20 17:16 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-02-20 17:16 UTC (permalink / raw)
  To: gcc-gnats


>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 <int N> void foo ();
}

template <int N> struct X {
    int m;
    int g () {
      NS::foo<sizeof(m)>();
    }
};

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<N>::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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg
@ 2003-02-24 20:54 oldham
  0 siblings, 0 replies; 4+ messages in thread
From: oldham @ 2003-02-24 20:54 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody, oldham

Synopsis: [3.4 regression] ICE with sizeof(expr) in non-type template arg

Responsible-Changed-From-To: unassigned->oldham
Responsible-Changed-By: oldham
Responsible-Changed-When: Mon Feb 24 20:54:17 2003
Responsible-Changed-Why:
    To fix the problem.
State-Changed-From-To: analyzed->closed
State-Changed-By: oldham
State-Changed-When: Mon Feb 24 20:54:17 2003
State-Changed-Why:
    The problem was resolved via a patch.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9778


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg
@ 2003-02-23 16:50 ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: ehrhardt @ 2003-02-23 16:50 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody

Synopsis: [3.4 regression] ICE with sizeof(expr) in non-type template arg

State-Changed-From-To: open->analyzed
State-Changed-By: cae
State-Changed-When: Sun Feb 23 16:50:28 2003
State-Changed-Why:
    This has been analyzed. Besides I can confirm that this is a regression
    from 3.2, hence priority high.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9778


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg
@ 2003-02-20 18:46 Steven Bosscher
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Bosscher @ 2003-02-20 18:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9778; it has been noted by GNATS.

From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
	bangerth@ticam.utexas.edu, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type
 template arg
Date: Thu, 20 Feb 2003 19:43:26 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9778
 
 devphil says:
 
 : Search converges between 2003-01-16-trunk (#103) and 2003-01-17-trunk 
 (#104).
 
 
 Line-numbered input is:
 ========================================
      1  namespace NS {
      2    template <int N> void foo ();
      3  }
      4 
      5  template <int N> struct X {
      6      int m;
      7      int g () {
      8        NS::foo<sizeof(m)>();
      9      }
     10  };
     11 
     12  template class X<2>;
     13 
 
 ========================================
 
 
 Diagnostic output follows, from the last compiler tested:
 input: In member function `int X<N>::g() [with int N = 2]':
 input:12:   instantiated from here
 input:8: internal compiler error: Segmentation fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 Compiler output follows, from the last compiler tested:
         .file   "input"
 
 
 Greetz
 Steven
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-24 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20 17:16 c++/9778: [3.4 regression] ICE with sizeof(expr) in non-type template arg bangerth
2003-02-20 18:46 Steven Bosscher
2003-02-23 16:50 ehrhardt
2003-02-24 20:54 oldham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).