public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2
@ 2003-10-29 20:43 waldeinburg at yahoo dot com
2003-10-29 20:44 ` [Bug c++/12831] " waldeinburg at yahoo dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: waldeinburg at yahoo dot com @ 2003-10-29 20:43 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
Summary: passing reference to pointer-to-member-function crashes
gcc 3.3.2
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: waldeinburg at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i486-debian-linux-gnu
GCC host triplet: i486-debian-linux-gnu
GCC target triplet: i486-debian-linux-gnu
The example attached compiles with gcc 2.95 (I hope this is correct behavior).
gcc 3.2 says:
conditional expression between distinct pointer types `int
(**)(...)' and `void (foo::**)()' lacks a cast
gcc 3.3.2 (the newest version provided by Debian - unstable) will crash with a
segmentation fault:
test2.cpp: I function 'int main()':
test2.cpp:25: internal compiler error: Lagersegmentfejl
It is simply compiled with
gcc -o test2 test2.cpp
About the example:
I made quz a template class because I discovered the problem using a container
class, but you can also make it crash by declaring it as
void qoo ( void (foo::* & p) (void) )
Output from gcc -v:
Læser specifikationer fra /usr/lib/gcc-lib/i486-linux/3.3.2/specs
Konfigureret med: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Trådmodel: posix
GCC version 3.3.2 (Debian)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] passing reference to pointer-to-member-function crashes gcc 3.3.2
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
@ 2003-10-29 20:44 ` waldeinburg at yahoo dot com
2003-10-29 20:52 ` waldeinburg at yahoo dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: waldeinburg at yahoo dot com @ 2003-10-29 20:44 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
------- Additional Comments From waldeinburg at yahoo dot com 2003-10-29 20:43 -------
Created an attachment (id=5017)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5017&action=view)
preprocessed file that triggers the bug
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] passing reference to pointer-to-member-function crashes gcc 3.3.2
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
2003-10-29 20:44 ` [Bug c++/12831] " waldeinburg at yahoo dot com
@ 2003-10-29 20:52 ` waldeinburg at yahoo dot com
2003-10-29 21:44 ` [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function bangerth at dealii dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: waldeinburg at yahoo dot com @ 2003-10-29 20:52 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
------- Additional Comments From waldeinburg at yahoo dot com 2003-10-29 20:44 -------
Created an attachment (id=5018)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5018&action=view)
the code that triggers the bug
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
2003-10-29 20:44 ` [Bug c++/12831] " waldeinburg at yahoo dot com
2003-10-29 20:52 ` waldeinburg at yahoo dot com
@ 2003-10-29 21:44 ` bangerth at dealii dot org
2003-10-30 15:45 ` waldeinburg at yahoo dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-10-29 21:44 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-invalid-code
Last reconfirmed|0000-00-00 00:00:00 |2003-10-29 21:43:15
date| |
Summary|passing reference to |[3.3 regression] ICE with
|pointer-to-member-function |passing reference to bound
|crashes gcc 3.3.2 |pointer-to-member-function
Target Milestone|--- |3.3.3
------- Additional Comments From bangerth at dealii dot org 2003-10-29 21:43 -------
The code is illegal: you are calling quz::qoo with
ifoo.*fun
which is a bound pointer to member (another ill-advised gcc extension).
You should really call it as
iquz.qoo (fun)
in which case all gcc versions accept the code.
Alas, the present state is not good either. 3.3.x ICEs on the code, which
one can consider a regression against 2.95 that silently accepted wrong
code. Present mainline states
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `int main()':
x.cc:16: error: no matching function for call to `quz<void
(foo::*)()>::qoo(void (foo::)())'
x.cc:7: note: candidates are: void quz<T>::qoo(T&) [with T = void (foo::*)()]
which is confusing because the data types do not reflect that we try to
call the function with a bound pointer.
That raises an interesting question, though: does there exist a standard
conversion from a bound pointer to an unbound one? If this were the case,
then the message would suddenly make sense: we would convert the bound
reference to member to an unbound reference to member and call quz::qoo with
that. It would take a reference-to-pointer conversion then.
To wrap up: don't invent half-baked extensions to the language (a message to
gcc developers)!
W.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (2 preceding siblings ...)
2003-10-29 21:44 ` [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function bangerth at dealii dot org
@ 2003-10-30 15:45 ` waldeinburg at yahoo dot com
2003-10-30 16:12 ` bangerth at dealii dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: waldeinburg at yahoo dot com @ 2003-10-30 15:45 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
------- Additional Comments From waldeinburg at yahoo dot com 2003-10-30 15:31 -------
So the following is also a bug (the same bug)?
class foo
{
public:
void bar (void)
{
}
};
int main (void)
{
foo ifoo;
void (foo::* pfun) (void) = & foo::bar;
pfun = ifoo.*pfun;
return 0;
}
I compiles, but I guess it does the same as
void (foo::* pfun) (void) = & ifoo.bar;
which of course triggers an error.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (3 preceding siblings ...)
2003-10-30 15:45 ` waldeinburg at yahoo dot com
@ 2003-10-30 16:12 ` bangerth at dealii dot org
2003-12-16 20:34 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-10-30 16:12 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
------- Additional Comments From bangerth at dealii dot org 2003-10-30 15:58 -------
That code should be just as invalid. ifoo.*pfun has no meaning unless
followed by function arguments. The same holds for ifoo.bar, and taking the
address of the latter makes no sense as well.
W.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (4 preceding siblings ...)
2003-10-30 16:12 ` bangerth at dealii dot org
@ 2003-12-16 20:34 ` pinskia at gcc dot gnu dot org
2003-12-24 21:42 ` gdr at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-16 20:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-16 20:24 -------
>From Phil's regression hunter: Search converges between 2003-06-25-3.3 (#149) and 2003-06
-26-3.3 (#150).
Fixed on the mainline: Search converges between 2003-07-03-trunk (#332) and 2003-07-04-
trunk (#333).
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-10-29 21:43:15 |2003-12-16 20:24:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (5 preceding siblings ...)
2003-12-16 20:34 ` pinskia at gcc dot gnu dot org
@ 2003-12-24 21:42 ` gdr at gcc dot gnu dot org
2004-02-15 12:36 ` gdr at gcc dot gnu dot org
2004-04-27 6:34 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-12-24 21:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2003-12-24 21:37 -------
Will investigate.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |gdr at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (6 preceding siblings ...)
2003-12-24 21:42 ` gdr at gcc dot gnu dot org
@ 2004-02-15 12:36 ` gdr at gcc dot gnu dot org
2004-04-27 6:34 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-02-15 12:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-02-15 12:36 -------
Adjust milestone
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.3.3 |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
` (7 preceding siblings ...)
2004-02-15 12:36 ` gdr at gcc dot gnu dot org
@ 2004-04-27 6:34 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-04-27 6:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-04-27 06:26 -------
Unfortunate bug/extension. Fixed in 3.4.0 and 3.5.0.
Won't fix in 3.3.x.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|3.3.4 |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12831
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-04-27 6:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-29 20:43 [Bug c++/12831] New: passing reference to pointer-to-member-function crashes gcc 3.3.2 waldeinburg at yahoo dot com
2003-10-29 20:44 ` [Bug c++/12831] " waldeinburg at yahoo dot com
2003-10-29 20:52 ` waldeinburg at yahoo dot com
2003-10-29 21:44 ` [Bug c++/12831] [3.3 regression] ICE with passing reference to bound pointer-to-member-function bangerth at dealii dot org
2003-10-30 15:45 ` waldeinburg at yahoo dot com
2003-10-30 16:12 ` bangerth at dealii dot org
2003-12-16 20:34 ` pinskia at gcc dot gnu dot org
2003-12-24 21:42 ` gdr at gcc dot gnu dot org
2004-02-15 12:36 ` gdr at gcc dot gnu dot org
2004-04-27 6:34 ` gdr 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).