This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/18881] New: bogus 'Cannot resolve function foo to any overloaded instance'


https://sourceware.org/bugzilla/show_bug.cgi?id=18881

            Bug ID: 18881
           Summary: bogus 'Cannot resolve function foo to any overloaded
                    instance'
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: msebor at redhat dot com
  Target Milestone: ---

In the test case below, GNU gdb (GDB) Fedora 7.8.2-38.fc21 fails to resolve the
call to foo() in the ternary ?:  expression even though it resolves it
successfully on its own.  This makes debugging GCC difficult because it
prevents gdb from printing the values of some of the tree-checking macros. For
example:

(gdb) macro expand DECL_IS_BUILTIN((tree)expr)
expands to: (((IS_ADHOC_LOC (((contains_struct_check (((tree)expr),
(TS_DECL_MINIMAL), "/home/msebor/scm/fsf/gcc-66516/gcc/c-family/c-common.c",
12896, __FUNCTION__))->decl_minimal.locus))) ? get_location_from_adhoc_loc
(line_table, ((contains_struct_check (((tree)expr), (TS_DECL_MINIMAL),
"/home/msebor/scm/fsf/gcc-66516/gcc/c-family/c-common.c", 12896,
__FUNCTION__))->decl_minimal.locus)) : (((contains_struct_check (((tree)expr),
(TS_DECL_MINIMAL), "/home/msebor/scm/fsf/gcc-66516/gcc/c-family/c-common.c",
12896, __FUNCTION__))->decl_minimal.locus))) <= ((source_location) 1))
(gdb) p DECL_IS_BUILTIN((tree)expr)
Cannot resolve function contains_struct_check to any overloaded instance

Test case:

$ cat t.cpp && gcc -g3 t.cpp && gdb -batch -ex 'b bar' -ex r -ex 'p FOO1(b)'
-ex 'p FOO2(b)' -ex 'p foo((A)b)' -ex 'p foo((A)b) ? foo((A)b) : foo((A)b)'
a.out
struct U { };

typedef U *A;
typedef const U *B;

A foo (A a) { return a; }
B foo (B b) { return b; }

#define FOO1(x) foo ((A)x)
#define FOO2(x) foo (FOO1 (x)) ? foo (FOO1 (x)) : foo (FOO1 (x))

int bar (B b)
{
    if (FOO2 (b))
        return 1;
    return 0;
}

int main ()
{
    U u = { };
    return bar (&u);
}
Breakpoint 1 at 0x40051e: file t.cpp, line 14.
warning: the debug information found in
"/usr/lib/debug//lib64/ld-2.20.so.debug" does not match
"/lib64/ld-linux-x86-64.so.2" (CRC mismatch).

warning: the debug information found in
"/usr/lib/debug//lib64/libc-2.20.so.debug" does not match "/lib64/libc.so.6"
(CRC mismatch).


Breakpoint 1, bar (b=0x7fffffffdeff) at t.cpp:14
14          if (FOO2 (b))
$1 = (U *) 0x7fffffffdeff
Cannot resolve function foo to any overloaded instance
$2 = (U *) 0x7fffffffdeff
Cannot resolve function foo to any overloaded instance

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]