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++/11961] New: Wrong type reported by gdb


This is a somewhat curious issue as one needs fairly recent gcc (>= 4.5) _and_
gdb ( > 2010-07-29 ) to reproduce.


----------------- snip -----------------
#!/bin/sh

# To reproduce:
#   - use g++ 4.5 or 4.6 (but not 4.4)
#   - use gdb from CVS from 2010-07-29 or newer

echo "

template<typename _ForwardIterator>
void x(_ForwardIterator __first)
{
}

template<typename T>
struct vector
{
    T* _M_start;
    vector() { x(_M_start); }
};

struct foo {};

int main()
{
    vector<foo> flist;
    foo *f = new foo;
}
" > foo.cpp

CXX=/usr/local/bin/i686-pc-linux-gnu-g++-4.5.0
CXX=/usr/bin/g++
CXX=/usr/local/bin/i686-pc-linux-gnu-g++-4.6.0

${CXX} -g foo.cpp -o foo

GDB=~/bin/gdb-7.1   # works
GDB=~/bin/gdb-7.0   # works
GDB=~/debugger/fsf-git/gdb/gdb  # "fails"

${GDB} -ex 'set confirm off' \
    -ex 'b main' -ex 'run' -ex 'p f' -ex 'q'\
    ./foo


# GNU gdb (GDB) 7.2.50.20100728-cvs
# [...]
# Breakpoint 1 at 0x80486d2: file foo.cpp, line 18.
# Breakpoint 1, main () at foo.cpp:18
# #18          foo *f = new foo;
# $1 = (_ForwardIterator) 0x402b8ff4
----------------- snip -----------------


The type 'ForwardIterator' is wrong, should be  (foo *)

-- 
           Summary: Wrong type reported by gdb
           Product: gdb
           Version: 7.1
            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
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11961

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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