diff options
author | Fernando Nasser <fnasser@redhat.com> | 2001-11-26 21:29:31 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@redhat.com> | 2001-11-26 21:29:31 +0000 |
commit | 184d0bc81cf0f61c1c6edeca34952673682b3198 (patch) | |
tree | a30a5e6292bed329620d97810ced5017fb7c0ba3 /gdb | |
parent | 5527febf4dc822e429e6316768a77dd63e5c7213 (diff) | |
download | gdb-184d0bc81cf0f61c1c6edeca34952673682b3198.zip gdb-184d0bc81cf0f61c1c6edeca34952673682b3198.tar.gz gdb-184d0bc81cf0f61c1c6edeca34952673682b3198.tar.bz2 |
2001-11-26 Fernando Nasser <fnasser@redhat.com>
From 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.base/callfuncs.c | 14 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/callfwmall.c | 14 |
2 files changed, 24 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c index 0fdc2fe..9917e78 100644 --- a/gdb/testsuite/gdb.base/callfuncs.c +++ b/gdb/testsuite/gdb.base/callfuncs.c @@ -133,7 +133,12 @@ int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } 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); } +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); } @@ -141,7 +146,12 @@ int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } 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); } +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. */ diff --git a/gdb/testsuite/gdb.base/callfwmall.c b/gdb/testsuite/gdb.base/callfwmall.c index 89e6a77..67edb8b 100644 --- a/gdb/testsuite/gdb.base/callfwmall.c +++ b/gdb/testsuite/gdb.base/callfwmall.c @@ -138,7 +138,12 @@ int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } 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); } +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); } @@ -146,7 +151,12 @@ int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } 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); } +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. */ |