public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11993] New: Strange behaviour - invalid information about objects.
@ 2010-09-08 18:00 dmitigr at gmail dot com
2010-09-08 18:02 ` [Bug c++/11993] " dmitigr at gmail dot com
2010-09-09 7:46 ` dmitigr at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: dmitigr at gmail dot com @ 2010-09-08 18:00 UTC (permalink / raw)
To: gdb-prs
// Author: Dmitriy Igrishin
// Date: 2010/09/08
// This example demonstrates the strange behaviour of GDB.
// Executable itself runs as expected.
// Tested with:
// g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
// GNU gdb (GDB) 7.0-ubuntu
// Compile command:
// g++ -Wall -std=c++98 -pedantic -g main.cpp -o main
#include <iostream>
#include <string>
template<class T>
class A {
public:
static const std::string f(const T& value);
};
template<class T> const std::string A<T>::f(const T& value)
{
std::string s = "Dima"; // look at the s or s.size() from GDB ;-)
// on my machine printing s.size() here
// cause SIGSEGV.
std::cerr << "A<T>::f(): s = \"" << s << "\""
<< " s.size() = " << s.size() << std::endl;
return s; // remove this return and s (and s.size())
// from GDB will be correct!
}
template<> const std::string A<int>::f(const int& value)
{
std::string s = "Alex"; // look at the s or s.size() from GDB ;-)
// on my machine printing s.size() cause
// unpredicable result.
std::cerr << "A<int>::f(): s = \"" << s << "\""
<< " s.size() = " << s.size() << std::endl;
return s; // remove this return and s (and s.size())
// from GDB will be correct!
}
int main(int argc, char* argv[])
{
A<int>::f(1);
A<double>::f(2.3);
}
--
Summary: Strange behaviour - invalid information about objects.
Product: gdb
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at sourceware dot org
ReportedBy: dmitigr at gmail dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11993
------- 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] 3+ messages in thread
* [Bug c++/11993] Strange behaviour - invalid information about objects.
2010-09-08 18:00 [Bug c++/11993] New: Strange behaviour - invalid information about objects dmitigr at gmail dot com
@ 2010-09-08 18:02 ` dmitigr at gmail dot com
2010-09-09 7:46 ` dmitigr at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: dmitigr at gmail dot com @ 2010-09-08 18:02 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From dmitigr at gmail dot com 2010-09-08 18:02 -------
Created an attachment (id=4972)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=4972&action=view)
Test case.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11993
------- 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] 3+ messages in thread
* [Bug c++/11993] Strange behaviour - invalid information about objects.
2010-09-08 18:00 [Bug c++/11993] New: Strange behaviour - invalid information about objects dmitigr at gmail dot com
2010-09-08 18:02 ` [Bug c++/11993] " dmitigr at gmail dot com
@ 2010-09-09 7:46 ` dmitigr at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: dmitigr at gmail dot com @ 2010-09-09 7:46 UTC (permalink / raw)
To: gdb-prs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
http://sourceware.org/bugzilla/show_bug.cgi?id=11993
------- 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] 3+ messages in thread
end of thread, other threads:[~2010-09-09 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 18:00 [Bug c++/11993] New: Strange behaviour - invalid information about objects dmitigr at gmail dot com
2010-09-08 18:02 ` [Bug c++/11993] " dmitigr at gmail dot com
2010-09-09 7:46 ` dmitigr at gmail 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).