public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27640]  New: segfault, related to constructor instantiation
@ 2006-05-17 12:32 tbm at cyrius dot com
  2006-05-17 12:33 ` [Bug c++/27640] " tbm at cyrius dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tbm at cyrius dot com @ 2006-05-17 12:32 UTC (permalink / raw)
  To: gcc-bugs

I get the following segfault with gcc 4.2.0 20060419.  4.0/4.1 work.

14640:tbm@deprecation: ~] /usr/lib/gcc-snapshot/bin/g++ -c mini.c
mini.c: In constructor 'refcounted<T, scalar>::refcounted(const A1&) [with A1 =
ref<nfsserv>, T = nfsserv_ac]':
mini.c:88:   instantiated from 'void sfsserver_cache_alloc(sfsprog*,
ref<nfsserv>, int, sfscd_mountarg*, ref<callback<void, const nfs_fh3*, void,
void> >) [with T = server]'
mini.c:102:   instantiated from here
mini.c:28: 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.


-- 
           Summary: segfault, related to constructor instantiation
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] segfault, related to constructor instantiation
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
@ 2006-05-17 12:33 ` tbm at cyrius dot com
  2006-05-17 16:28 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tbm at cyrius dot com @ 2006-05-17 12:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tbm at cyrius dot com  2006-05-17 12:32 -------
Created an attachment (id=11483)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11483&action=view)
test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] segfault, related to constructor instantiation
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
  2006-05-17 12:33 ` [Bug c++/27640] " tbm at cyrius dot com
@ 2006-05-17 16:28 ` pinskia at gcc dot gnu dot org
  2006-05-18  4:01 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-17 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-05-17 16:28 -------
Back trace:
#0  0x001a2758 in expand_virtual_init (binfo=0xd8c0c0, decl=0xd92840) at
../../gcc/cp/init.c:781
#1  0x0019fb7c in dfs_initialize_vtbl_ptrs (binfo=0xd8c0c0, data=0xdb63c0) at
../../gcc/cp/init.c:112
#2  0x001bccd0 in dfs_walk_once_r (binfo=0xd8c0c0, pre_fn=0x19f8fc
<dfs_initialize_vtbl_ptrs>, post_fn=0, data=0xdb63c0) at
../../gcc/cp/search.c:1576
#3  0x001bd3f8 in dfs_walk_once (binfo=0xd8c0c0, pre_fn=0x19f8fc
<dfs_initialize_vtbl_ptrs>, post_fn=0, data=0xdb63c0) at
../../gcc/cp/search.c:1659
#4  0x0019fc74 in initialize_vtbl_ptrs (addr=0xd92840) at
../../gcc/cp/init.c:134
#5  0x001a2394 in emit_mem_initializers (mem_inits=0x0) at
../../gcc/cp/init.c:713
#6  0x001cac54 in finish_mem_initializers (mem_inits=0xdb2ae0) at
../../gcc/cp/semantics.c:1332
#7  0x000a7fb4 in tsubst_expr (t=0x434eb7c0, args=0xd8eda0,
complain=tf_warning_or_error, in_decl=0xd89c40) at ../../gcc/cp/pt.c:8195


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] segfault, related to constructor instantiation
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
  2006-05-17 12:33 ` [Bug c++/27640] " tbm at cyrius dot com
  2006-05-17 16:28 ` pinskia at gcc dot gnu dot org
@ 2006-05-18  4:01 ` pinskia at gcc dot gnu dot org
  2006-05-18  4:25 ` [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-18  4:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-05-18 04:01 -------
Reducing, I have it down to 43 lines.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (2 preceding siblings ...)
  2006-05-18  4:01 ` pinskia at gcc dot gnu dot org
@ 2006-05-18  4:25 ` pinskia at gcc dot gnu dot org
  2006-05-21 21:25 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-18  4:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-05-18 04:25 -------
Confirmed, reduced testcase:
template < class T > struct refcounted : 
virtual T
{
    template < class A1 > refcounted (const A1 & a1) : T () { }
};
struct nfsserv {};
template < class T >
void
sfsserver_cache_alloc (int *ns)
{
    new refcounted < nfsserv > (*ns);
}
void
usage ()
{
    sfsserver_cache_alloc < int > ( 0);
}

if we change sfsserver_cache_alloc to be a non template it works.
If we change the new ... to a local variable it works.
if we change the argument type of sfsserver_cache_alloc to nfsserv, we get a
secondary bogus error message:
t.cc: In constructor 'refcounted<T>::refcounted(const A1&) [with A1 = nfsserv,
T = nfsserv]':
t.cc:11:   instantiated from 'void sfsserver_cache_alloc(nfsserv*) [with T =
int]'
t.cc:16:   instantiated from here
t.cc:4: error: could not convert 'a1' to 'bool'


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i486-linux-gnu              |
   GCC host triplet|i486-linux-gnu              |
 GCC target triplet|i486-linux-gnu              |
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.2.0
      Known to work|                            |4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-18 04:25:04
               date|                            |
            Summary|segfault, related to        |[4.2 Regression] segfault,
                   |constructor instantiation   |related to constructor
                   |                            |instantiation and virtual
                   |                            |base case and templates and
                   |                            |new operator
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (3 preceding siblings ...)
  2006-05-18  4:25 ` [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator pinskia at gcc dot gnu dot org
@ 2006-05-21 21:25 ` pinskia at gcc dot gnu dot org
  2006-05-22 19:49 ` janis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-21 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-05-21 21:24 -------
Janis, could you regression hunt on this bug?

Thanks,
Andrew Pinski


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janis at gcc dot gnu dot org
           Keywords|                            |rejects-valid


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (4 preceding siblings ...)
  2006-05-21 21:25 ` pinskia at gcc dot gnu dot org
@ 2006-05-22 19:49 ` janis at gcc dot gnu dot org
  2006-06-04 19:11 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-05-22 19:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janis at gcc dot gnu dot org  2006-05-22 19:48 -------
A regression hunt on powerpc-linux using the testcase from comment #4
identified this patch:

http://gcc.gnu.org/viewcvs?view=rev&rev=112869

r112869 | mmitchel | 2006-04-11 22:59:57 +0000 (Tue, 11 Apr 2006)


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (5 preceding siblings ...)
  2006-05-22 19:49 ` janis at gcc dot gnu dot org
@ 2006-06-04 19:11 ` mmitchel at gcc dot gnu dot org
  2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-04 19:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (6 preceding siblings ...)
  2006-06-04 19:11 ` mmitchel at gcc dot gnu dot org
@ 2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
  2006-06-16  2:09 ` mmitchel at gcc dot gnu dot org
  2006-06-16  2:20 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-15  6:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (7 preceding siblings ...)
  2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
@ 2006-06-16  2:09 ` mmitchel at gcc dot gnu dot org
  2006-06-16  2:20 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16  2:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mmitchel at gcc dot gnu dot org  2006-06-16 02:09 -------
Subject: Bug 27640

Author: mmitchel
Date: Fri Jun 16 02:09:10 2006
New Revision: 114701

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114701
Log:
        PR c++/27640
        * pt.c (instantiate_template): Set processing_template_decl to
        zero while performing substitutions.
        PR c++/27640
        * g++.dg/template/ctor7.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/ctor7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

* [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator
  2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
                   ` (8 preceding siblings ...)
  2006-06-16  2:09 ` mmitchel at gcc dot gnu dot org
@ 2006-06-16  2:20 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16  2:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mmitchel at gcc dot gnu dot org  2006-06-16 02:11 -------
Fixed in 4.2.0.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27640


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

end of thread, other threads:[~2006-06-16  2:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17 12:32 [Bug c++/27640] New: segfault, related to constructor instantiation tbm at cyrius dot com
2006-05-17 12:33 ` [Bug c++/27640] " tbm at cyrius dot com
2006-05-17 16:28 ` pinskia at gcc dot gnu dot org
2006-05-18  4:01 ` pinskia at gcc dot gnu dot org
2006-05-18  4:25 ` [Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator pinskia at gcc dot gnu dot org
2006-05-21 21:25 ` pinskia at gcc dot gnu dot org
2006-05-22 19:49 ` janis at gcc dot gnu dot org
2006-06-04 19:11 ` mmitchel at gcc dot gnu dot org
2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
2006-06-16  2:09 ` mmitchel at gcc dot gnu dot org
2006-06-16  2:20 ` mmitchel at gcc dot gnu dot org

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).