From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15917 invoked by alias); 6 Mar 2011 14:23:45 -0000 Received: (qmail 15909 invoked by uid 22791); 6 Mar 2011 14:23:45 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 Mar 2011 14:23:40 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p26ENdj8026040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 6 Mar 2011 09:23:39 -0500 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p26ENbLF032510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 6 Mar 2011 09:23:39 -0500 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p26ENbRT002440; Sun, 6 Mar 2011 15:23:37 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p26ENbNq002439; Sun, 6 Mar 2011 15:23:37 +0100 Date: Sun, 06 Mar 2011 16:17:00 -0000 From: Jan Kratochvil To: Michael Snyder Cc: "gdb-patches@sourceware.org" Subject: Re: [RFA] mdebugread.c (psymtab_to_symtab_1): assert that 'fh' is not null Message-ID: <20110306142337.GB1895@host1.jankratochvil.net> References: <4D71648B.1090101@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D71648B.1090101@vmware.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2011-03/txt/msg00394.txt.bz2 On Fri, 04 Mar 2011 23:15:39 +0100, Michael Snyder wrote: > This occurs along a path where fh *could* be null, and then we > dereference it. I agree there is a bug. > + gdb_assert (fh); [...] > parse_external (ext_ptr, fh->fBigendian, > pst->section_offsets, pst->objfile); But I find as even a worse bug to introduce such an assertion without any comment there. I at least myself perceive any assertions that the programmer thinks such invariant is valid there. That invariant says that if its negation happens then the programmer was wrong. If there is a known bug you have found and you just do not intend to fix it now I find introducing such an assertion as misleading. The reader then assumes such invariant and can do additional wrong conclusions from it. In such case there should be primarily a "FIXME" comment, best even to reference a filed a Bug. There can be also an assertion there but the "FIXME" I find essential there. Thanks, Jan