From: Jackie Smith Cashion <jsmith@redhat.com>
To: GDB Patches <gdb-patches@sources.redhat.com>
Subject: RFA: callfuncs.c and callfwmall.c
Date: Fri, 02 Nov 2001 00:29:00 -0000 [thread overview]
Message-ID: <3BF07179.B6E9C4FF@redhat.com> (raw)
The functions "char *t_structs_a" in gdb/testsuite/callfuncs.c and
callfwmall.c erroneously return a pointer to a local variable. Please
consider the following change.
2001-11-12 Jackie Smith Cashion <jsmith@redhat.com>
* gdb.base/callfuncs.c (t_structs_a): Do not return a pointer
to a local (non-static) variable. Copy tstruct.a to a static buffer
and return a pointer to that buffer.
* gdb.base/callfwmall.c (t_structs_a): Ditto.
Index: callfuncs.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 callfuncs.c
*** callfuncs.c 2001/11/08 19:08:34 1.3
--- callfuncs.c 2001/11/13 00:36:29
*************** int t_structs_i (struct struct1 tstru
*** 133,139 ****
long t_structs_l (struct struct1 tstruct) { return (tstruct.l); }
float t_structs_f (struct struct1 tstruct) { return (tstruct.f); }
double t_structs_d (struct struct1 tstruct) { return (tstruct.d); }
! char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); }
#else
char t_structs_c (tstruct) struct struct1 tstruct; { return
(tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return
(tstruct.s); }
--- 133,144 ----
long t_structs_l (struct struct1 tstruct) { return (tstruct.l); }
float t_structs_f (struct struct1 tstruct) { return (tstruct.f); }
double t_structs_d (struct struct1 tstruct) { return (tstruct.d); }
! char *t_structs_a (struct struct1 tstruct)
! {
! static char buf[8];
! strcpy (buf, tstruct.a);
! return buf;
! }
#else
char t_structs_c (tstruct) struct struct1 tstruct; { return
(tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return
(tstruct.s); }
*************** int t_structs_i (tstruct) struct stru
*** 141,147 ****
long t_structs_l (tstruct) struct struct1 tstruct; { return
(tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return
(tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return
(tstruct.d); }
! char *t_structs_a (tstruct) struct struct1 tstruct; { return
(tstruct.a); }
#endif
/* Test that calling functions works if there are a lot of arguments.
*/
--- 146,157 ----
long t_structs_l (tstruct) struct struct1 tstruct; { return
(tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return
(tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return
(tstruct.d); }
! char *t_structs_a (tstruct) struct struct1 tstruct;
! {
! static char buf[8];
! strcpy (buf, tstruct.a);
! return buf;
! }
#endif
/* Test that calling functions works if there are a lot of arguments.
*/
Index: callfwmall.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfwmall.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 callfwmall.c
*** callfwmall.c 2001/11/08 19:08:34 1.2
--- callfwmall.c 2001/11/13 00:36:29
*************** int t_structs_i (struct struct1 tstru
*** 138,144 ****
long t_structs_l (struct struct1 tstruct) { return (tstruct.l); }
float t_structs_f (struct struct1 tstruct) { return (tstruct.f); }
double t_structs_d (struct struct1 tstruct) { return (tstruct.d); }
! char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); }
#else
char t_structs_c (tstruct) struct struct1 tstruct; { return
(tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return
(tstruct.s); }
--- 138,149 ----
long t_structs_l (struct struct1 tstruct) { return (tstruct.l); }
float t_structs_f (struct struct1 tstruct) { return (tstruct.f); }
double t_structs_d (struct struct1 tstruct) { return (tstruct.d); }
! char *t_structs_a (struct struct1 tstruct)
! {
! static char buf[8];
! strcpy (buf, tstruct.a);
! return buf;
! }
#else
char t_structs_c (tstruct) struct struct1 tstruct; { return
(tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return
(tstruct.s); }
*************** int t_structs_i (tstruct) struct stru
*** 146,152 ****
long t_structs_l (tstruct) struct struct1 tstruct; { return
(tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return
(tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return
(tstruct.d); }
! char *t_structs_a (tstruct) struct struct1 tstruct; { return
(tstruct.a); }
#endif
/* Test that calling functions works if there are a lot of arguments.
*/
--- 151,162 ----
long t_structs_l (tstruct) struct struct1 tstruct; { return
(tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return
(tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return
(tstruct.d); }
! char *t_structs_a (tstruct) struct struct1 tstruct;
! {
! static char buf[8];
! strcpy (buf, tstruct.a);
! return buf;
! }
#endif
/* Test that calling functions works if there are a lot of arguments.
*/
next reply other threads:[~2001-11-13 1:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-02 0:29 Jackie Smith Cashion [this message]
2001-11-12 17:07 ` Fernando Nasser
2001-11-26 11:41 ` Fernando Nasser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BF07179.B6E9C4FF@redhat.com \
--to=jsmith@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox