public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/12281] New: Incorrect interpretation of returned point in 64 bit platform
@ 2010-12-02 7:31 youngtsai at yahoo dot com.tw
2010-12-02 17:39 ` [Bug exp/12281] " youngtsai at yahoo dot com.tw
0 siblings, 1 reply; 2+ messages in thread
From: youngtsai at yahoo dot com.tw @ 2010-12-02 7:31 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12281
Summary: Incorrect interpretation of returned point in 64 bit
platform
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: exp
AssignedTo: unassigned@sourceware.org
ReportedBy: youngtsai@yahoo.com.tw
Environment
OS :
Linux spx919 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64
x86_64 GNU/Linux
g++ version:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3
--enable-libgcj-multifile --enable-languages=c,c++,java,f95
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
gdb version:
GNU gdb Red Hat Linux (6.3.0.0-1.153.el4rh)
Problem description -
Calling the funtion in gdb in 64 bit platform , the returned pointer will be
interpreted as 4 bytes (more like integer) if the program is not compiled with
-g. Following list the reproduced steps.
Reproduced steps -
1. g++ test.C (the source file is as following)
2. gdb a.out
(gdb) break main
Breakpoint 1 at 0x4005d4
(gdb) run
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Breakpoint 1, 0x00000000004005d4 in main ()
(gdb) print (char *)func2()
$1 = 0xffffffff9558c010 <Address 0xffffffff9558c010 out of bounds>
(gdb) print sizeof(func2())
$2 = 4
test.C
====================================================
#include <stdio.h>
#include <string.h>
char *func1()
{
static char str1[100]="abcde";
return str1;
}
char *func2()
{
char *str = new char[10000000000];
strcpy(str,"abc");
return str;
}
main()
{
func1();
func2();
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug exp/12281] Incorrect interpretation of returned point in 64 bit platform
2010-12-02 7:31 [Bug exp/12281] New: Incorrect interpretation of returned point in 64 bit platform youngtsai at yahoo dot com.tw
@ 2010-12-02 17:39 ` youngtsai at yahoo dot com.tw
0 siblings, 0 replies; 2+ messages in thread
From: youngtsai at yahoo dot com.tw @ 2010-12-02 17:39 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12281
youngtsai at yahoo dot com.tw changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |youngtsai at yahoo dot
| |com.tw
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-02 7:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-02 7:31 [Bug exp/12281] New: Incorrect interpretation of returned point in 64 bit platform youngtsai at yahoo dot com.tw
2010-12-02 17:39 ` [Bug exp/12281] " youngtsai at yahoo dot com.tw
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).