public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29054]  New: ICE on friend template specialization
@ 2006-09-13  3:19 Thomas8675309 at yahoo dot com
  2006-09-13 11:39 ` [Bug c++/29054] [4.0/4.1 Regression] " rguenth at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Thomas8675309 at yahoo dot com @ 2006-09-13  3:19 UTC (permalink / raw)
  To: gcc-bugs

The following program:

struct A {
    template <typename T, typename U>
    static A create(U) {}
};

namespace N {
  class B {
      B() {}
      friend A A::create<B, const char*>(const char*);
  };
}

int main()
{
    A a;
    a.create<N::B>("test");
}

compiled as follows:

g++ -v -c test.cpp

produces an ICE:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1/work/gcc-4.1.1/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--disable-nls --with-system-zlib --disable-checking --disable-werror
--disable-libunwind-exceptions --disable-multilib --disable-libmudflap
--disable-libssp --disable-libgcj --enable-languages=c,c++ --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1)
 /usr/libexec/gcc/i686-pc-linux-gnu/4.1.1/cc1plus -quiet -v -D_GNU_SOURCE
test.cpp -quiet -dumpbase test.cpp -mtune=pentiumpro -auxbase test -version -o
/tmp/ccCmgFxT.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/backward
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
 /usr/include
End of search list.
GNU C++ version 4.1.1 (Gentoo 4.1.1) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.1 (Gentoo 4.1.1).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ea9667438f8bc79493837ce647b4862c
test.cpp: In static member function 'static A A::create(U) [with T = N::B, U =
const char*]':
test.cpp:16:   instantiated from here
test.cpp:9: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccA9Qsu8.out file, please attach this to
your bugreport.

Best regards,

Tom


-- 
           Summary: ICE on friend template specialization
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas8675309 at yahoo dot com


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
@ 2006-09-13 11:39 ` rguenth at gcc dot gnu dot org
  2006-09-13 11:42 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-09-13 11:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-09-13 11:39 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.0.3 4.1.1
      Known to work|4.2.0                       |3.4.6 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-13 11:39:13
               date|                            |
            Summary|ICE on friend template      |[4.0/4.1 Regression] ICE on
                   |specialization              |friend template
                   |                            |specialization


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
  2006-09-13 11:39 ` [Bug c++/29054] [4.0/4.1 Regression] " rguenth at gcc dot gnu dot org
@ 2006-09-13 11:42 ` rguenth at gcc dot gnu dot org
  2006-10-28 17:57 ` Thomas8675309 at yahoo dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-09-13 11:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-09-13 11:41 -------
(gdb) run
Starting program: /abuild/rguenther/gcc41-g/gcc/cc1plus -quiet t.ii

Program received signal SIGSEGV, Segmentation fault.
0x080f565b in instantiate_decl (d=0xb7d9cf00, defer_ok=0, 
    expl_inst_class_mem_p=0 '\0')
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/cp/pt.c:11957
11957             spec_parm = TREE_CHAIN (spec_parm);

both tmpl_parm and spec_parm are zero.

(gdb) bt
#0  0x080f565b in instantiate_decl (d=0xb7d9cf00, defer_ok=0, 
    expl_inst_class_mem_p=0 '\0')
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/cp/pt.c:11957
#1  0x080f5e1a in instantiate_pending_templates (retries=0)
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/cp/pt.c:12065
#2  0x0813fa19 in cp_finish_file ()
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/cp/decl2.c:2857
#3  0x08049d18 in finish_file ()
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/cp/cp-lang.c:144
#4  0x0826bac4 in c_common_parse_file (set_yydebug=0)
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/c-opts.c:1144
#5  0x086d9d84 in compile_file ()
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/toplev.c:991
#6  0x086db68f in do_compile ()
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/toplev.c:1949
#7  0x086db6f1 in toplev_main (argc=3, argv=0xbf939b04)
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/toplev.c:1981
#8  0x0827e022 in main (argc=Cannot access memory at address 0x0
)
    at /space/rguenther/src/svn/gcc-4_1-branch/gcc/main.c:35


-- 


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
  2006-09-13 11:39 ` [Bug c++/29054] [4.0/4.1 Regression] " rguenth at gcc dot gnu dot org
  2006-09-13 11:42 ` rguenth at gcc dot gnu dot org
@ 2006-10-28 17:57 ` Thomas8675309 at yahoo dot com
  2006-10-28 18:06 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Thomas8675309 at yahoo dot com @ 2006-10-28 17:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from Thomas8675309 at yahoo dot com  2006-10-28 17:57 -------
If one clicks on the list of "All regressions" for GCC 4.1.1 from the main
page, http://gcc.gnu.org, this bug doesn't come up.  Any idea why?


-- 


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (2 preceding siblings ...)
  2006-10-28 17:57 ` Thomas8675309 at yahoo dot com
@ 2006-10-28 18:06 ` pinskia at gcc dot gnu dot org
  2006-11-01 18:26 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-28 18:06 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.2


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (3 preceding siblings ...)
  2006-10-28 18:06 ` pinskia at gcc dot gnu dot org
@ 2006-11-01 18:26 ` mmitchel at gcc dot gnu dot org
  2007-01-02 15:58 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-11-01 18:26 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=29054


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (4 preceding siblings ...)
  2006-11-01 18:26 ` mmitchel at gcc dot gnu dot org
@ 2007-01-02 15:58 ` jakub at gcc dot gnu dot org
  2007-01-02 16:53 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-02 15:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-01-02 15:58 -------
I believe this was fixed by the PR26912 (4.2+ version) fix.
Before those changes, the this argument was added by grokclassfn, after that
change it is being added to all METHOD_TYPE type decls in grokfndecl.
grokfndecl is here called from the friend decl, so grokdeclarator's:
8388                /* All method decls are public, so tell grokfndecl to set
8389                   TREE_PUBLIC, also.  */
8390                decl = grokfndecl (ctype, type,
8391                                   TREE_CODE (unqualified_id) !=
TEMPLATE_ID_EXPR
8392                                   ? unqualified_id : dname,
8393                                   parms,
8394                                   unqualified_id,
8395                                   virtualp, flags, quals, raises,
8396                                   friendp ? -1 : 0, friendp, 1, 0, sfk,
8397                                   funcdef_flag, template_count,
in_namespace,
friendp is non-zero and therefore grokclassfn is never called.
Later on revert_static_member_fn assumes the first argument is "this" without
checking it and eats the first argument.

Mark, do you think it is better for 4.1 to backport another part of your
changes
(i.e. the build_this_parm function addition and related changes), or e.g.
just copy over the "this" addition code after this grokfndecl call if
(friendp)?
Or change revert_static_method to only remove "this" argument?


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (5 preceding siblings ...)
  2007-01-02 15:58 ` jakub at gcc dot gnu dot org
@ 2007-01-02 16:53 ` jakub at gcc dot gnu dot org
  2007-01-03  8:01 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-02 16:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-01-02 16:53 -------
The second option really is not possible, grokclassfn is usually called by
do_friend.  But on this testcase revert_static_member_fn is called
earlier than do_friend (from check_explicit_specialization from
grokdeclarator),
so it had no chance yet to add that argument.


-- 


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (6 preceding siblings ...)
  2007-01-02 16:53 ` jakub at gcc dot gnu dot org
@ 2007-01-03  8:01 ` jakub at gcc dot gnu dot org
  2007-01-03  8:06 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-03  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2007-01-03 08:00 -------
Subject: Bug 29054

Author: jakub
Date: Wed Jan  3 08:00:30 2007
New Revision: 120384

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120384
Log:
        PR c++/29054
        * g++.dg/template/friend49.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/friend49.C
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (7 preceding siblings ...)
  2007-01-03  8:01 ` jakub at gcc dot gnu dot org
@ 2007-01-03  8:06 ` jakub at gcc dot gnu dot org
  2007-01-03  8:11 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-03  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2007-01-03 08:06 -------
Subject: Bug 29054

Author: jakub
Date: Wed Jan  3 08:05:53 2007
New Revision: 120388

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120388
Log:
        PR c++/29054
        * g++.dg/template/friend49.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/template/friend49.C
Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/29054] [4.0/4.1 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (8 preceding siblings ...)
  2007-01-03  8:06 ` jakub at gcc dot gnu dot org
@ 2007-01-03  8:11 ` jakub at gcc dot gnu dot org
  2007-01-03  8:16 ` [Bug c++/29054] [4.0 " jakub at gcc dot gnu dot org
  2007-02-12 21:27 ` reichelt at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-03  8:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2007-01-03 08:11 -------
Subject: Bug 29054

Author: jakub
Date: Wed Jan  3 08:11:02 2007
New Revision: 120391

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120391
Log:
        PR c++/29054
        * decl.c (revert_static_member_fn): Don't remove first
        argument without checking it is "this".

        * g++.dg/template/friend49.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/friend49.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/decl.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/29054] [4.0 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (9 preceding siblings ...)
  2007-01-03  8:11 ` jakub at gcc dot gnu dot org
@ 2007-01-03  8:16 ` jakub at gcc dot gnu dot org
  2007-02-12 21:27 ` reichelt at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-01-03  8:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2007-01-03 08:16 -------
Fixed on gcc-4_1-branch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
      Known to work|3.4.6 4.2.0                 |3.4.6 4.2.0 4.1.2
   Last reconfirmed|2006-09-13 11:39:13         |2007-01-03 08:16:35
               date|                            |
            Summary|[4.0/4.1 Regression] ICE on |[4.0 Regression] ICE on
                   |friend template             |friend template
                   |specialization              |specialization


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


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

* [Bug c++/29054] [4.0 Regression] ICE on friend template specialization
  2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
                   ` (10 preceding siblings ...)
  2007-01-03  8:16 ` [Bug c++/29054] [4.0 " jakub at gcc dot gnu dot org
@ 2007-02-12 21:27 ` reichelt at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-02-12 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from reichelt at gcc dot gnu dot org  2007-02-12 21:27 -------
Was not fixed on the 4.0 branch.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-02-12 21:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-13  3:19 [Bug c++/29054] New: ICE on friend template specialization Thomas8675309 at yahoo dot com
2006-09-13 11:39 ` [Bug c++/29054] [4.0/4.1 Regression] " rguenth at gcc dot gnu dot org
2006-09-13 11:42 ` rguenth at gcc dot gnu dot org
2006-10-28 17:57 ` Thomas8675309 at yahoo dot com
2006-10-28 18:06 ` pinskia at gcc dot gnu dot org
2006-11-01 18:26 ` mmitchel at gcc dot gnu dot org
2007-01-02 15:58 ` jakub at gcc dot gnu dot org
2007-01-02 16:53 ` jakub at gcc dot gnu dot org
2007-01-03  8:01 ` jakub at gcc dot gnu dot org
2007-01-03  8:06 ` jakub at gcc dot gnu dot org
2007-01-03  8:11 ` jakub at gcc dot gnu dot org
2007-01-03  8:16 ` [Bug c++/29054] [4.0 " jakub at gcc dot gnu dot org
2007-02-12 21:27 ` reichelt 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).