public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131
@ 2013-02-07 22:29 dsagald8 at gmail dot com
2013-02-07 23:45 ` [Bug c++/56247] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: dsagald8 at gmail dot com @ 2013-02-07 22:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Bug #: 56247
Summary: internal compiler error: in tsubst_copy, at
cp/pt.c:12131
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dsagald8@gmail.com
Created attachment 29392
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29392
Test case
ICE when the same member function pointer (to a base class's method) is used as
a template parameter from two different methods of the same templated child
class. What's a bit unusual here is that the bug is only triggered if the same
instantiation occurs in two different methods.
The reduced test case is short enough to include directly:
--------
struct Base {
void method() {}
};
typedef void (Base::*MemPtr)();
// Template with a member function pointer "non-type parameter".
template<MemPtr func>
struct Wrapper {};
template<class C>
struct Child : public Base {
// Templated derived class instantiates the Wrapper with the same parameter
// in two different virtual methods.
void foo() { typedef Wrapper<&Base::method> W; }
void bar() { typedef Wrapper<&Base::method> W; }
};
// Instantiate Child with some type.
template class Child<int>;
--------
Here's the detailed gcc output:
% /usr/local/bin/g++47 -v -save-temps -c bugtest.cc
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++47
Target: x86_64-portbld-freebsd8.2
Configured with: ./../gcc-4.7-20120818/configure --disable-nls
--enable-languages=c,c++,objc,fortran --libdir=/usr/local/lib/gcc47
--libexecdir=/usr/local/libexec/gcc47 --program-suffix=47
--with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc47/include/c++/
--with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib
--enable-languages=c,c++,objc,fortran,java --prefix=/usr/local
--mandir=/usr/local/man --infodir=/usr/local/info/gcc47
--build=x86_64-portbld-freebsd8.2
Thread model: posix
gcc version 4.7.2 20120818 (prerelease) (FreeBSD Ports Collection)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/cc1plus -E -quiet
-v src/scratch/bugtest.cc -mtune=generic -march=x86-64 -fpch-preprocess -o
bugtest.ii
ignoring nonexistent directory
"/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/../../../../../x86_64-portbld-freebsd8.2/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc47/include/c++/
/usr/local/lib/gcc47/include/c++//x86_64-portbld-freebsd8.2
/usr/local/lib/gcc47/include/c++//backward
/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/include
/usr/local/include
/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/include-fixed
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/cc1plus
-fpreprocessed bugtest.ii -quiet -dumpbase bugtest.cc -mtune=generic
-march=x86-64 -auxbase bugtest -version -o bugtest.s
GNU C++ (FreeBSD Ports Collection) version 4.7.2 20120818 (prerelease)
(x86_64-portbld-freebsd8.2)
compiled by GNU C version 4.7.2 20120818 (prerelease), GMP version
5.0.1, MPFR version 3.0.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (FreeBSD Ports Collection) version 4.7.2 20120818 (prerelease)
(x86_64-portbld-freebsd8.2)
compiled by GNU C version 4.7.2 20120818 (prerelease), GMP version
5.0.1, MPFR version 3.0.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4c5936a9f1a6230b2e84e5f997572e48
src/scratch/bugtest.cc: In instantiation of 'void Child<C>::bar() [with C =
int]':
src/scratch/bugtest.cc:21:16: required from here
src/scratch/bugtest.cc:17:49: internal compiler error: in tsubst_copy, at
cp/pt.c:12131
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
@ 2013-02-07 23:45 ` paolo.carlini at oracle dot com
2013-02-08 8:46 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-07 23:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-07
Summary|internal compiler error: in |[4.6/4.7/4.8 Regression]
|tsubst_copy, at |internal compiler error: in
|cp/pt.c:12131 |tsubst_copy, at
| |cp/pt.c:12131
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-07 23:44:56 UTC ---
Confirmed. 4.5.4 works for me.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
2013-02-07 23:45 ` [Bug c++/56247] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
@ 2013-02-08 8:46 ` jakub at gcc dot gnu.org
2013-02-08 14:54 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-08 8:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Target Milestone|--- |4.6.4
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-08 08:46:12 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149223
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
2013-02-07 23:45 ` [Bug c++/56247] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
2013-02-08 8:46 ` jakub at gcc dot gnu.org
@ 2013-02-08 14:54 ` rguenth at gcc dot gnu.org
2013-02-08 20:06 ` jason at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-08 14:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (2 preceding siblings ...)
2013-02-08 14:54 ` rguenth at gcc dot gnu.org
@ 2013-02-08 20:06 ` jason at gcc dot gnu.org
2013-02-09 20:39 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-08 20:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (3 preceding siblings ...)
2013-02-08 20:06 ` jason at gcc dot gnu.org
@ 2013-02-09 20:39 ` jason at gcc dot gnu.org
2013-02-09 20:47 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-09 20:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-09 20:39:21 UTC ---
Author: jason
Date: Sat Feb 9 20:39:13 2013
New Revision: 195922
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195922
Log:
PR c++/56247
* pt.c (eq_specializations): Set comparing_specializations.
* tree.c (cp_tree_equal): Check it.
* cp-tree.h: Declare it.
Added:
trunk/gcc/testsuite/g++.dg/template/ptrmem23.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c
trunk/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (4 preceding siblings ...)
2013-02-09 20:39 ` jason at gcc dot gnu.org
@ 2013-02-09 20:47 ` jason at gcc dot gnu.org
2013-02-09 20:54 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-09 20:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-09 20:47:31 UTC ---
Author: jason
Date: Sat Feb 9 20:47:24 2013
New Revision: 195923
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195923
Log:
PR c++/56247
* pt.c (eq_specializations): Set comparing_specializations.
* tree.c (cp_tree_equal): Check it.
* cp-tree.h: Declare it.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/ptrmem23.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/cp-tree.h
branches/gcc-4_7-branch/gcc/cp/pt.c
branches/gcc-4_7-branch/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (5 preceding siblings ...)
2013-02-09 20:47 ` jason at gcc dot gnu.org
@ 2013-02-09 20:54 ` jason at gcc dot gnu.org
2013-02-11 8:48 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-09 20:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-09 20:54:05 UTC ---
Author: jason
Date: Sat Feb 9 20:53:59 2013
New Revision: 195924
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195924
Log:
PR c++/56247
* pt.c (eq_specializations): Set comparing_specializations.
* tree.c (cp_tree_equal): Check it.
* cp-tree.h: Declare it.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/ptrmem23.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/cp-tree.h
branches/gcc-4_6-branch/gcc/cp/pt.c
branches/gcc-4_6-branch/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (6 preceding siblings ...)
2013-02-09 20:54 ` jason at gcc dot gnu.org
@ 2013-02-11 8:48 ` jakub at gcc dot gnu.org
2013-03-01 19:59 ` dsagald8 at gmail dot com
2020-04-18 10:55 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-11 8:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-11 08:48:14 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (7 preceding siblings ...)
2013-02-11 8:48 ` jakub at gcc dot gnu.org
@ 2013-03-01 19:59 ` dsagald8 at gmail dot com
2020-04-18 10:55 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: dsagald8 at gmail dot com @ 2013-03-01 19:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
DS <dsagald8 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
--- Comment #7 from DS <dsagald8 at gmail dot com> 2013-03-01 19:59:04 UTC ---
Awesome quick work. Very impressive -- thank you!
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/56247] [4.6/4.7/4.8 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:12131
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
` (8 preceding siblings ...)
2013-03-01 19:59 ` dsagald8 at gmail dot com
@ 2020-04-18 10:55 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-18 10:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:f83adb68ed9cef1fbd4c16447eb4e89676df9f62
commit r10-7787-gf83adb68ed9cef1fbd4c16447eb4e89676df9f62
Author: Patrick Palka <ppalka@redhat.com>
Date: Sat Apr 18 06:22:21 2020 -0400
c++: spec_hasher::equal and PARM_DECLs [PR94632]
In the testcase below, during specialization of c<int>::d, we build two
identical specializations of the parameter type b<decltype(e)::k> -- one
when
substituting into c<int>::d's TYPE_ARG_TYPES and another when substituting
into
c<int>::d's DECL_ARGUMENTS.
We don't reuse the first specialization the second time around as a
consequence
of the fix for PR c++/56247 which made PARM_DECLs always compare different
from
one another during spec_hasher::equal. As a result, when looking up
existing
specializations of 'b', spec_hasher::equal considers the template argument
decltype(e')::k to be different from decltype(e'')::k, where e' and e'' are
the
result of two calls to tsubst_copy on the PARM_DECL e.
Since the two specializations are considered different due to the mentioned
fix,
their TYPE_CANONICAL points to themselves even though they are otherwise
identical types, and this triggers an ICE in
maybe_rebuild_function_decl_type
when comparing the TYPE_ARG_TYPES of c<int>::d to its DECL_ARGUMENTS.
This patch fixes this issue at the spec_hasher::equal level by ignoring the
'comparing_specializations' flag in cp_tree_equal whenever the
DECL_CONTEXTs of
the two parameters are identical. This seems to be a sufficient condition
to be
able to correctly compare PARM_DECLs structurally. (This also subsumes the
CONSTRAINT_VAR_P check since constraint variables all have empty, and
therefore
identical, DECL_CONTEXTs.)
gcc/cp/ChangeLog:
PR c++/94632
* tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
comparing_specializations if the parameters' contexts are
identical.
gcc/testsuite/ChangeLog:
PR c++/94632
* g++.dg/template/canon-type-14.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-04-18 10:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 22:29 [Bug c++/56247] New: internal compiler error: in tsubst_copy, at cp/pt.c:12131 dsagald8 at gmail dot com
2013-02-07 23:45 ` [Bug c++/56247] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
2013-02-08 8:46 ` jakub at gcc dot gnu.org
2013-02-08 14:54 ` rguenth at gcc dot gnu.org
2013-02-08 20:06 ` jason at gcc dot gnu.org
2013-02-09 20:39 ` jason at gcc dot gnu.org
2013-02-09 20:47 ` jason at gcc dot gnu.org
2013-02-09 20:54 ` jason at gcc dot gnu.org
2013-02-11 8:48 ` jakub at gcc dot gnu.org
2013-03-01 19:59 ` dsagald8 at gmail dot com
2020-04-18 10:55 ` cvs-commit at gcc dot gnu.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).