public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
@ 2010-11-23 19:10 zsojka at seznam dot cz
2010-11-23 20:01 ` [Bug c++/46626] " redi at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: zsojka at seznam dot cz @ 2010-11-23 19:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
Summary: [4.6 Regression] simple use of virtual methods causes
pure virtual method call in c++0x mode
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zsojka@seznam.cz
Target: x86_64-pc-linux-gnu
Created attachment 22501
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22501
reduced testcase
$ g++ -std=c++0x testcase.C
$ ./a.out
pure virtual method called
terminate called without an active exception
Aborted
Tested revisions
r167054 - fail
r167002 - fail
r165699 - OK
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
@ 2010-11-23 20:01 ` redi at gcc dot gnu.org
2010-11-23 20:07 ` hjl.tools at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2010-11-23 20:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-23 19:37:08 UTC ---
related to PR 46526 ?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
2010-11-23 20:01 ` [Bug c++/46626] " redi at gcc dot gnu.org
@ 2010-11-23 20:07 ` hjl.tools at gmail dot com
2010-11-23 20:21 ` hjl.tools at gmail dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hjl.tools at gmail dot com @ 2010-11-23 20:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2010.11.23 19:57:55
CC| |jason at redhat dot com
Target Milestone|--- |4.6.0
Ever Confirmed|0 |1
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-23 19:57:55 UTC ---
It is caused by revision 166167:
http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00053.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
2010-11-23 20:01 ` [Bug c++/46626] " redi at gcc dot gnu.org
2010-11-23 20:07 ` hjl.tools at gmail dot com
@ 2010-11-23 20:21 ` hjl.tools at gmail dot com
2010-11-24 12:04 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hjl.tools at gmail dot com @ 2010-11-23 20:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-23 19:58:33 UTC ---
(In reply to comment #1)
> related to PR 46526 ?
Revision 167049 still fails.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (2 preceding siblings ...)
2010-11-23 20:21 ` hjl.tools at gmail dot com
@ 2010-11-24 12:04 ` rguenth at gcc dot gnu.org
2010-12-08 0:43 ` zsojka at seznam dot cz
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-24 12:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (3 preceding siblings ...)
2010-11-24 12:04 ` rguenth at gcc dot gnu.org
@ 2010-12-08 0:43 ` zsojka at seznam dot cz
2010-12-08 2:07 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: zsojka at seznam dot cz @ 2010-12-08 0:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> 2010-12-08 00:43:03 UTC ---
This seems to cause FAILs in libstdc++ testsuite with -O0, for example:
$ g++ 42819.ii -std=gnu++0x
$ ./a.out
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error 18446744073709551615
Aborted
(all failures I encountered are from 30_threads)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (4 preceding siblings ...)
2010-12-08 0:43 ` zsojka at seznam dot cz
@ 2010-12-08 2:07 ` redi at gcc dot gnu.org
2010-12-08 12:40 ` zsojka at seznam dot cz
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-08 2:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-08 02:07:31 UTC ---
Most of the 30_threads tests will abort without -pthread
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (5 preceding siblings ...)
2010-12-08 2:07 ` redi at gcc dot gnu.org
@ 2010-12-08 12:40 ` zsojka at seznam dot cz
2010-12-23 12:35 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: zsojka at seznam dot cz @ 2010-12-08 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #6 from Zdenek Sojka <zsojka at seznam dot cz> 2010-12-08 12:39:59 UTC ---
Thank you, I did my flag reduction wrongly. It seems using of precompiled
headers sometimes causes wrong code, but it's unrelated to this PR.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (6 preceding siblings ...)
2010-12-08 12:40 ` zsojka at seznam dot cz
@ 2010-12-23 12:35 ` jakub at gcc dot gnu.org
2010-12-25 1:49 ` roman at binarylife dot net
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-23 12:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-23 12:34:40 UTC ---
Created attachment 22846
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22846
gcc46-pr46626.patch
Untested fix. The problem seems to be that the B::B() ctor body, which is
constexpr (and g++ generated) has a CLEANUP_STMT in it, and
build_data_member_initialization ignores CLEANUP_STMT, which means the setting
of vtable pointer to _ZTV1B + 16 is ignored, thus it stays to be _ZTV1A + 16.
The attached patch handles CLEANUP_BODY of CLEANUP_STMT by recursing into it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (7 preceding siblings ...)
2010-12-23 12:35 ` jakub at gcc dot gnu.org
@ 2010-12-25 1:49 ` roman at binarylife dot net
2010-12-27 12:54 ` jakub at gcc dot gnu.org
2010-12-27 13:15 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: roman at binarylife dot net @ 2010-12-25 1:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #8 from Roman Kononov <roman at binarylife dot net> 2010-12-25 01:49:05 UTC ---
With the patch applied to r168236:
$ cat test.cpp
struct X {
virtual int& x(int&)=0;
virtual ~X() {}
};
struct Y {
virtual int& y(int&)=0;
virtual ~Y() {}
};
struct Z: X, Y {
int& x(int&);
int& y(int&);
};
void func() {
Z z;
}
$ g++ -c -std=c++0x test.cpp
test.cpp: In function 'void func()':
test.cpp:17:7: in constexpr expansion of 'z.Z::Z()'
test.cpp:17:7: internal compiler error: in cxx_eval_bare_aggregate, at
cp/semantics.c:6352
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Without the patch, with the same test.cpp:
$ g++ -c -std=c++0x test.cpp; echo $?
0
Without the patch, with slightly different test1.cpp:
0 rk@wata:~/tmp/qqq>cat test1.cpp
struct X {
virtual int& x(int&)=0;
// virtual ~X() {}
};
struct Y {
virtual int& y(int&)=0;
// virtual ~Y() {}
};
struct Z: X, Y {
int& x(int&);
int& y(int&);
};
void func() {
Z z;
}
0 rk@wata:~/tmp/qqq>g++ -c -std=c++0x test1.cpp
test1.cpp: In function 'void func()':
test1.cpp:17:7: in constexpr expansion of 'z.Z::Z()'
test1.cpp:17:7: internal compiler error: in cxx_eval_bare_aggregate, at
cp/semantics.c:6338
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] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (8 preceding siblings ...)
2010-12-25 1:49 ` roman at binarylife dot net
@ 2010-12-27 12:54 ` jakub at gcc dot gnu.org
2010-12-27 13:15 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-27 12:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-27 12:54:34 UTC ---
Author: jakub
Date: Mon Dec 27 12:54:30 2010
New Revision: 168271
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168271
Log:
PR c++/46626
* semantics.c (build_data_member_initialization): For CLEANUP_STMT
recurse into CLEANUP_BODY.
* g++.dg/cpp0x/constexpr-base4.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-base4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
` (9 preceding siblings ...)
2010-12-27 12:54 ` jakub at gcc dot gnu.org
@ 2010-12-27 13:15 ` jakub at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-27 13:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46626
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-27 13:15:24 UTC ---
I see the ICE with the second testcase from #c8 back till r166167, therefore
please file it as a separate bugreport, it is not related to this one.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-12-27 13:15 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 19:10 [Bug c++/46626] New: [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode zsojka at seznam dot cz
2010-11-23 20:01 ` [Bug c++/46626] " redi at gcc dot gnu.org
2010-11-23 20:07 ` hjl.tools at gmail dot com
2010-11-23 20:21 ` hjl.tools at gmail dot com
2010-11-24 12:04 ` rguenth at gcc dot gnu.org
2010-12-08 0:43 ` zsojka at seznam dot cz
2010-12-08 2:07 ` redi at gcc dot gnu.org
2010-12-08 12:40 ` zsojka at seznam dot cz
2010-12-23 12:35 ` jakub at gcc dot gnu.org
2010-12-25 1:49 ` roman at binarylife dot net
2010-12-27 12:54 ` jakub at gcc dot gnu.org
2010-12-27 13:15 ` jakub 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).