public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/10343] New: gdb selects wrong function overload
@ 2009-06-29 10:24 andre dot poenitz at nokia dot com
2010-01-22 21:43 ` [Bug c++/10343] " tromey at redhat dot com
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: andre dot poenitz at nokia dot com @ 2009-06-29 10:24 UTC (permalink / raw)
To: gdb-prs
The following code results in gdb using the
'int *' overload instead of the 'void *' one
when used with a 'char *' argument.
#include <iostream>
int foo(void *p) { std::cerr << "UNKNOWN " << std::endl; }
int foo(int *p) { std::cerr << "INT: " << *p << std::endl; }
struct S {};
int main(int argc, char *argv[])
{
int a = 1;
S b;
char c = 1;
double d = 1;
return a + c;
}
/*
Breakpoint 1, main () at main.cpp:19
19 int a = 1;
(gdb) call foo(&a)
INT: -1081818280
$6 = 134520896
(gdb) call foo(&b)
UNKNOWN
$7 = 134520896
(gdb) call foo(&c)
INT: 141559812
$8 = 134520896
(gdb) call foo(&d)
UNKNOWN
$9 = 134520896
(gdb)
--
Summary: gdb selects wrong function overload
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at sourceware dot org
ReportedBy: andre dot poenitz at nokia dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=10343
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/10343] gdb selects wrong function overload
2009-06-29 10:24 [Bug c++/10343] New: gdb selects wrong function overload andre dot poenitz at nokia dot com
@ 2010-01-22 21:43 ` tromey at redhat dot com
2010-01-25 17:54 ` tromey at redhat dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2010-01-22 21:43 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2010-01-22 21:43:31
date| |
http://sourceware.org/bugzilla/show_bug.cgi?id=10343
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/10343] gdb selects wrong function overload
2009-06-29 10:24 [Bug c++/10343] New: gdb selects wrong function overload andre dot poenitz at nokia dot com
2010-01-22 21:43 ` [Bug c++/10343] " tromey at redhat dot com
@ 2010-01-25 17:54 ` tromey at redhat dot com
2010-07-23 14:56 ` swagiaal at redhat dot com
2010-07-26 18:26 ` swagiaal at redhat dot com
3 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2010-01-25 17:54 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2010-01-25 17:54 -------
I looked into this a little.
The bug is that gdb does not properly implement all the overloading rules.
In particular, in this case, rank_one_type recurses for pointer types.
This leads it to believe that char* is convertible to int*, because
there is a char->int conversion.
I think it would be simple to fix this particular failure, but there are others
lurking. For example, baseclass conversions are ordered by distance, but
rank_one_type does not do this.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
Last reconfirmed|2010-01-22 21:43:31 |2010-01-25 17:54:14
date| |
http://sourceware.org/bugzilla/show_bug.cgi?id=10343
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/10343] gdb selects wrong function overload
2009-06-29 10:24 [Bug c++/10343] New: gdb selects wrong function overload andre dot poenitz at nokia dot com
2010-01-22 21:43 ` [Bug c++/10343] " tromey at redhat dot com
2010-01-25 17:54 ` tromey at redhat dot com
@ 2010-07-23 14:56 ` swagiaal at redhat dot com
2010-07-26 18:26 ` swagiaal at redhat dot com
3 siblings, 0 replies; 7+ messages in thread
From: swagiaal at redhat dot com @ 2010-07-23 14:56 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |swagiaal at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=10343
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/10343] gdb selects wrong function overload
2009-06-29 10:24 [Bug c++/10343] New: gdb selects wrong function overload andre dot poenitz at nokia dot com
` (2 preceding siblings ...)
2010-07-23 14:56 ` swagiaal at redhat dot com
@ 2010-07-26 18:26 ` swagiaal at redhat dot com
3 siblings, 0 replies; 7+ messages in thread
From: swagiaal at redhat dot com @ 2010-07-26 18:26 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware dot|swagiaal at redhat dot com
|org |
Status|NEW |ASSIGNED
http://sourceware.org/bugzilla/show_bug.cgi?id=10343
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <bug-10343-4717@http.sourceware.org/bugzilla/>]
end of thread, other threads:[~2011-11-18 16:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29 10:24 [Bug c++/10343] New: gdb selects wrong function overload andre dot poenitz at nokia dot com
2010-01-22 21:43 ` [Bug c++/10343] " tromey at redhat dot com
2010-01-25 17:54 ` tromey at redhat dot com
2010-07-23 14:56 ` swagiaal at redhat dot com
2010-07-26 18:26 ` swagiaal at redhat dot com
[not found] <bug-10343-4717@http.sourceware.org/bugzilla/>
2010-10-05 18:53 ` swagiaal at redhat dot com
2011-11-18 16:17 ` tromey at redhat dot com
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).