Article View: gnu.gdb.bug
Article #10005GDB 3.5 reports wrong value for functions yielding char (on sparcs)
From: Paul Eggert
Date: Wed, 03 Oct 1990 01:22
Date: Wed, 03 Oct 1990 01:22
44 lines
2239 bytes
2239 bytes
When a function yields a value of type 'char', GDB 3.5 doesn't display the
returned value correctly (with GCC 1.37.1, GAS 1.36, Sparcstation 1+, SunOS
4.1). Here is an example:
213-ata% cat t.c
char p() { return 1; }
main() { return p(); }
214-ata% gcc -g -v t.c
gcc version 1.37.1
/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__su
n__ -D__unix__ t.c /usr/tmp/cca13099.cpp
GNU CPP version 1.37.1
/local/lib/gcc-cc1 /usr/tmp/cca13099.cpp -quiet -dumpbase t.c -g -version -o /u
sr/tmp/cca13099.s
GNU C version 1.37.1 (sparc) compiled by GNU C version 1.37.1.
default target switches: -mfpu -mepilogue
/local/lib/gcc-as -o t.o /usr/tmp/cca13099.s
ld -e start -dc -dp -Bstatic /lib/crt0.o t.o /local/lib/gcc-gnulib -lg -lc /loc
al/lib/gcc-gnulib
215-ata% gdb a.out
GDB 3.5, Copyright (C) 1989 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /tmp/a.out...done.
Type "help" for a list of commands.
(gdb) b p
Reading in symbols for t.c...done.
Breakpoint 1 at 0x2294: file t.c, line 1.
(gdb) r
Starting program: /tmp/a.out
Bpt 1, p () (t.c line 1)
1 char p() { return 1; }
(gdb) finish
Run till exit from #0 p () (t.c line 1)
0x22bc in main () (t.c line 2)
2 main() { return p(); }
Value returned is $1 = 0 '\000'
The value returned is actually 1, but GDB displays it as 0 in the last line of
the output above.
Technical Details
Message-ID:
<9010030122.AA13117@ata.twinsun.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!twinsun.com!eggertShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5053,5d5f907c213994b3,start X-Google-Attributes: gidf5053,public X-Google-ArrivalTime: 1990-10-03 00:56:23 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!twinsun.com!eggert From: eggert@twinsun.com (Paul Eggert) Newsgroups: gnu.gdb.bug Subject: GDB 3.5 reports wrong value for functions yielding char (on sparcs) Message-ID: <9010030122.AA13117@ata.twinsun.com> Date: 3 Oct 90 01:22:45 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 44 Posted: Wed Oct 3 02:22:45 1990