From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29682 invoked by alias); 21 Jan 2007 13:07:38 -0000 Received: (qmail 29489 invoked by uid 22791); 21 Jan 2007 13:07:37 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 21 Jan 2007 13:07:28 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.13.8/8.13.8) with ESMTP id l0LD7FKx006553; Sun, 21 Jan 2007 14:07:15 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.13.8/8.13.8/Submit) id l0LD7EO0000187; Sun, 21 Jan 2007 14:07:14 +0100 (CET) Date: Sun, 21 Jan 2007 13:07:00 -0000 Message-Id: <200701211307.l0LD7EO0000187@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: gdb-patches@sourceware.org, hongjiu.lu@intel.com In-reply-to: <20070116065937.GA15794@nevyn.them.org> (message from Daniel Jacobowitz on Tue, 16 Jan 2007 01:59:38 -0500) Subject: Re: PATCH: Initialize tmp_obstack References: <20061202182712.GA623@lucon.org> <20061205204003.GB25572@nevyn.them.org> <12601.163.1.150.229.1165354805.squirrel@webmail.xs4all.nl> <20061205214306.GA29801@nevyn.them.org> <20637.163.1.150.229.1165355320.squirrel@webmail.xs4all.nl> <20061205215639.GA30371@nevyn.them.org> <20061205235848.GA2551@nevyn.them.org> <20061207144018.GA12915@nevyn.them.org> <20061225040032.GA29719@nevyn.them.org> <20070116065937.GA15794@nevyn.them.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00432.txt.bz2 > Date: Tue, 16 Jan 2007 01:59:38 -0500 > From: Daniel Jacobowitz > > On Sun, Dec 24, 2006 at 11:00:32PM -0500, Daniel Jacobowitz wrote: > > I'm travelling again - excuse spotty response this week, please. But > that means I'm hacking on GDB on my laptop again, which is affected by > this problem. > > How can we avoid the uninitialized warnings? I had another look and come up with the attached. By always initializing tmp_obstack the code is less optimal, but at least I can convince myself the code is safe now. Unfortunately I can't test whether this fixes the GCC 4.1 warnings. Index: ChangeLog from Mark Kettenis * cp-valprint.c (cp_print_value_fields, cp_print_value): Always initialize tmp_obstack. Index: cp-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/cp-valprint.c,v retrieving revision 1.47 diff -u -p -r1.47 cp-valprint.c --- cp-valprint.c 9 Jan 2007 17:58:50 -0000 1.47 +++ cp-valprint.c 21 Jan 2007 12:44:23 -0000 @@ -167,7 +167,6 @@ cp_print_value_fields (struct type *type struct type **dont_print_vb,int dont_print_statmem) { int i, len, n_baseclasses; - struct obstack tmp_obstack; char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack); int fields_seen = 0; @@ -197,12 +196,13 @@ cp_print_value_fields (struct type *type fprintf_filtered (stream, ""); else { + struct obstack tmp_obstack = dont_print_statmem_obstack; + if (dont_print_statmem == 0) { /* If we're at top level, carve out a completely fresh chunk of the obstack and use that until this particular invocation returns. */ - tmp_obstack = dont_print_statmem_obstack; obstack_finish (&dont_print_statmem_obstack); } @@ -426,9 +426,9 @@ cp_print_value (struct type *type, struc struct ui_file *stream, int format, int recurse, enum val_prettyprint pretty, struct type **dont_print_vb) { - struct obstack tmp_obstack; struct type **last_dont_print = (struct type **) obstack_next_free (&dont_print_vb_obstack); + struct obstack tmp_obstack = dont_print_vb_obstack; int i, n_baseclasses = TYPE_N_BASECLASSES (type); int thisoffset; struct type *thistype; @@ -438,7 +438,6 @@ cp_print_value (struct type *type, struc /* If we're at top level, carve out a completely fresh chunk of the obstack and use that until this particular invocation returns. */ - tmp_obstack = dont_print_vb_obstack; /* Bump up the high-water mark. Now alpha is omega. */ obstack_finish (&dont_print_vb_obstack); }