From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3324 invoked by alias); 13 Nov 2001 01:07:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3281 invoked from network); 13 Nov 2001 01:07:07 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sourceware.cygnus.com with SMTP; 13 Nov 2001 01:07:07 -0000 Received: from redhat.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA25898 for ; Mon, 12 Nov 2001 17:07:03 -0800 (PST) Message-ID: <3BF07179.B6E9C4FF@redhat.com> Date: Fri, 02 Nov 2001 00:29:00 -0000 From: Jackie Smith Cashion X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: GDB Patches Subject: RFA: callfuncs.c and callfwmall.c Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00020.txt.bz2 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 * 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. */