public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51884] New: ICE with c++11 thread and templates
@ 2012-01-17 17:13 bluescarni at gmail dot com
2012-01-17 17:32 ` [Bug c++/51884] " bluescarni at gmail dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: bluescarni at gmail dot com @ 2012-01-17 17:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Bug #: 51884
Summary: ICE with c++11 thread and templates
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bluescarni@gmail.com
Created attachment 26354
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26354
Code snippet demonstrating the issue.
The attached minimal code snippet causes an ICE on g++-4.5.3, g++-4.6.2 and
g++-4.7.0-alpha20111231. The compilation command is:
g++ -std=c++0x bug.cpp
The output on 4.5:
In file included from bug.cpp:1:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/thread:112:7: internal
compiler error: in dfs_walk_once, at cp/search.c:1645
The output on 4.6:
In file included from bug.cpp:1:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/thread:109:14: internal
compiler error: in dfs_walk_once, at cp/search.c:1659
The output on 4.7:
‘
In file included from bug.cpp:1:0:
in dfs_walk_once, at cp/search.c:1695
The ICE is avoided at least in these cases:
- replace the method bar() with a non-templated version,
- replace the std::enable_if<...> enabler with void.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] ICE with c++11 thread and templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
@ 2012-01-17 17:32 ` bluescarni at gmail dot com
2012-01-17 18:26 ` bluescarni at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bluescarni at gmail dot com @ 2012-01-17 17:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
--- Comment #1 from Francesco Biscani <bluescarni at gmail dot com> 2012-01-17 17:02:16 UTC ---
Created attachment 26355
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26355
Code snippet demonstrating the issue.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] ICE with c++11 thread and templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
2012-01-17 17:32 ` [Bug c++/51884] " bluescarni at gmail dot com
@ 2012-01-17 18:26 ` bluescarni at gmail dot com
2012-01-18 1:01 ` paolo.carlini at oracle dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bluescarni at gmail dot com @ 2012-01-17 18:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
--- Comment #2 from Francesco Biscani <bluescarni at gmail dot com> 2012-01-17 17:03:03 UTC ---
Sorry, had initially uploaded the wrong code snippet, now it should be the
correct one.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] ICE with c++11 thread and templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
2012-01-17 17:32 ` [Bug c++/51884] " bluescarni at gmail dot com
2012-01-17 18:26 ` bluescarni at gmail dot com
@ 2012-01-18 1:01 ` paolo.carlini at oracle dot com
2012-01-18 1:05 ` paolo.carlini at oracle dot com
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-18 1:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] ICE with c++11 thread and templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (2 preceding siblings ...)
2012-01-18 1:01 ` paolo.carlini at oracle dot com
@ 2012-01-18 1:05 ` paolo.carlini at oracle dot com
2012-01-18 3:04 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-18 1:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2012-01-17
CC|bluescarni at gmail dot com |
Ever Confirmed|0 |1
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-17 23:44:46 UTC ---
Please try to reduce the testcase to something of manageable size (in terms of
-I size, those includes are big!). See:
http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] ICE with c++11 thread and templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (3 preceding siblings ...)
2012-01-18 1:05 ` paolo.carlini at oracle dot com
@ 2012-01-18 3:04 ` pinskia at gcc dot gnu.org
2012-01-18 3:23 ` [Bug c++/51884] lamba with templates pinskia at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-18 3:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-17 23:58:06 UTC ---
reducing ...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] lamba with templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (4 preceding siblings ...)
2012-01-18 3:04 ` pinskia at gcc dot gnu.org
@ 2012-01-18 3:23 ` pinskia at gcc dot gnu.org
2013-03-05 20:08 ` [Bug c++/51884] lambda " jason at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-18 3:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Summary|ICE with c++11 thread and |lamba with templates
|templates |
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-18 01:01:11 UTC ---
Reduced testcase as far as I can do it, any more it does not ICE:
template<typename _Tp> struct is_same { static const int value = 0; };
template<int> struct enable_if {
typedef void type;
};
template<typename _Tp> class shared_ptr {};
struct thread {
struct _Impl_base {
virtual void _M_run() = 0;
};
template<typename _Callable>
struct _Impl : _Impl_base { };
template<typename _Callable>
thread(_Callable&& __f) {
_M_start_thread(_M_make_routine( __f));
}
template<typename _Callable>
shared_ptr<_Impl<_Callable>> _M_make_routine(_Callable&& __f);
};
template <typename T, typename = void> struct foo {};
template <typename T> struct foo<T,typename enable_if<is_same<T>::value>::type>
{
template <bool Bar> void bar() const {
auto f = [](){};
thread thr(f);
}
};
int main() {
foo<int> f;
f.bar<true>();
}
--- CUT ---
Note the original testcase had a _M_start_thread defined but this does not.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] lambda with templates
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (5 preceding siblings ...)
2012-01-18 3:23 ` [Bug c++/51884] lamba with templates pinskia at gcc dot gnu.org
@ 2013-03-05 20:08 ` jason at gcc dot gnu.org
2013-03-06 14:09 ` [Bug c++/51884] [C++11] ICE with local class/lambda template argument jason at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-05 20:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-05 20:07:20 UTC ---
Slightly reduced again. Note that this testcase uses a normal local class
rather than a lambda; the only C++11 feature it uses is local types as template
arguments.
template<typename _Tp> struct is_same { static const int value = 0; };
template<int> struct enable_if {
typedef void type;
};
struct thread {
struct _Impl_base {
virtual void _M_run();
};
template<typename _Callable>
struct _Impl : _Impl_base { };
template<typename _Callable>
thread(const _Callable& __f) {
_M_start_thread(_M_make_routine(__f));
}
template<typename _Callable>
_Impl<_Callable> _M_make_routine(const _Callable& __f);
};
template <typename T, typename = void> struct foo;
template <typename T> struct foo<T,typename enable_if<is_same<T>::value>::type>
{
template <bool Bar> void bar() const {
struct A { } a;
thread thr(a);
}
};
int main() {
foo<int> f;
f.bar<true>();
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] [C++11] ICE with local class/lambda template argument
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (6 preceding siblings ...)
2013-03-05 20:08 ` [Bug c++/51884] lambda " jason at gcc dot gnu.org
@ 2013-03-06 14:09 ` jason at gcc dot gnu.org
2013-03-08 16:04 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-06 14:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Summary|lambda with templates |[C++11] ICE with local
| |class/lambda template
| |argument
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-06 14:09:01 UTC ---
And reduced again, as much as possible. The ICE is caused by trying to
generate the partially-instantiated type of foo<int>::bar, and thereby looking
up test<int>::value, which uses the (non-reentrant) dfs functions, in order to
mangle the name of B<C>'s vtable, which is also done using the dfs functions.
template<typename>
struct test { static const int value = 0; };
template<int>
struct enable_if { typedef void type; };
struct A { virtual void f() {} };
template<typename> struct B : A { };
template<typename, typename = void> struct foo;
template<typename T>
struct foo<T,typename enable_if<test<T>::value>::type>
{
template <bool> void bar() const {
struct C { } c;
B<C> b;
}
};
int main() {
foo<int> f;
f.bar<true>();
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] [C++11] ICE with local class/lambda template argument
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (7 preceding siblings ...)
2013-03-06 14:09 ` [Bug c++/51884] [C++11] ICE with local class/lambda template argument jason at gcc dot gnu.org
@ 2013-03-08 16:04 ` jason at gcc dot gnu.org
2013-03-08 16:05 ` jason at gcc dot gnu.org
2013-03-08 16:09 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-08 16:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-08 16:03:57 UTC ---
Author: jason
Date: Fri Mar 8 16:03:48 2013
New Revision: 196549
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196549
Log:
PR c++/51494
PR c++/51884
PR c++/56222
* tree.c (maybe_dummy_object): Don't capture 'this'.
* semantics.c (maybe_resolve_dummy): New.
(finish_non_static_data_member): Use it.
(finish_qualified_id_expr): Don't test is_dummy_object.
* cp-tree.h: Declare maybe_resolve_dummy.
* call.c (build_new_method_call_1): Use it.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/semantics.c
trunk/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] [C++11] ICE with local class/lambda template argument
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (8 preceding siblings ...)
2013-03-08 16:04 ` jason at gcc dot gnu.org
@ 2013-03-08 16:05 ` jason at gcc dot gnu.org
2013-03-08 16:09 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-08 16:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-08 16:04:30 UTC ---
Author: jason
Date: Fri Mar 8 16:04:15 2013
New Revision: 196551
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196551
Log:
PR c++/51884
* class.c (modify_all_vtables): Mangle the vtable name before
entering dfs_walk.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/local-targ1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/51884] [C++11] ICE with local class/lambda template argument
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
` (9 preceding siblings ...)
2013-03-08 16:05 ` jason at gcc dot gnu.org
@ 2013-03-08 16:09 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-08 16:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.8.0
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-08 16:09:09 UTC ---
Fixed for 4.8.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-03-08 16:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17 17:13 [Bug c++/51884] New: ICE with c++11 thread and templates bluescarni at gmail dot com
2012-01-17 17:32 ` [Bug c++/51884] " bluescarni at gmail dot com
2012-01-17 18:26 ` bluescarni at gmail dot com
2012-01-18 1:01 ` paolo.carlini at oracle dot com
2012-01-18 1:05 ` paolo.carlini at oracle dot com
2012-01-18 3:04 ` pinskia at gcc dot gnu.org
2012-01-18 3:23 ` [Bug c++/51884] lamba with templates pinskia at gcc dot gnu.org
2013-03-05 20:08 ` [Bug c++/51884] lambda " jason at gcc dot gnu.org
2013-03-06 14:09 ` [Bug c++/51884] [C++11] ICE with local class/lambda template argument jason at gcc dot gnu.org
2013-03-08 16:04 ` jason at gcc dot gnu.org
2013-03-08 16:05 ` jason at gcc dot gnu.org
2013-03-08 16:09 ` jason 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).