From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125298 invoked by alias); 17 Apr 2019 00:03:11 -0000 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 Received: (qmail 125288 invoked by uid 89); 17 Apr 2019 00:03:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HTo:U*tom X-HELO: mail-wr1-f66.google.com Received: from mail-wr1-f66.google.com (HELO mail-wr1-f66.google.com) (209.85.221.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Apr 2019 00:03:09 +0000 Received: by mail-wr1-f66.google.com with SMTP id q1so29463220wrp.0 for ; Tue, 16 Apr 2019 17:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZEiNS3jOaeJYXfR+9BVRu+L/K+VK8f8i9UHVJ9hBcBs=; b=ZQ0tTEvrL2+W7lUpXcj4zvkiNwB0iGNqCsi4jcd1QRuz95LCyrPI+1jgvFRrJbr9jc OmBHWhY24tMcxQpBbh2VxKrphJeymW3+hji6FkMoAs141OC07Eof7p/qvNEbMMnVVfE0 2piEDDbjeWcdM1m9gV4dUoTf6QyJwKrf3pDCojsjvEq5ZtN/KqXXVzrBRjs3p3KVLUhs 9DHaDbUPujoIDBQfVudPLr1g8Ah7/2vFdZ7d75TLorwGz9ubJh1TXSWfHAutIN3Z4Flt U1yyw2ij9CD0mA18/ycW9i2jEfNHrngPaVkwNRhOsh0UHTEu3vXhHpAOXyZnsT4fQkUy WQtQ== Return-Path: Received: from localhost (host86-164-133-98.range86-164.btcentralplus.com. [86.164.133.98]) by smtp.gmail.com with ESMTPSA id u189sm1658352wme.25.2019.04.16.17.03.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 17:03:06 -0700 (PDT) Date: Wed, 17 Apr 2019 00:03:00 -0000 From: Andrew Burgess To: Tom Tromey Cc: Sergio Durigan Junior , gdb-patches@sourceware.org, Richard Bunt Subject: Re: New FAIL on gdb.base/complex-parts.exp - unix/-m32 Message-ID: <20190417000305.GQ2737@embecosm.com> References: <854230b716fa6838bd2d8e73f1fd2d342a7a75ed.1552913183.git.andrew.burgess@embecosm.com> <87ftqndlb6.fsf_-_@redhat.com> <20190413000202.GF2737@embecosm.com> <87k1ftu7jb.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k1ftu7jb.fsf@tromey.com> X-Fortune: Have a nice day! X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00289.txt.bz2 * Tom Tromey [2019-04-16 12:30:48 -0600]: > >>>>> "Andrew" == Andrew Burgess writes: > > Andrew> The problem is that GDB tries to find a builtin floating point type of > Andrew> the correct size in order to reuse the name of that type as the name > Andrew> for the components of the complex type being built. > > This patch caused a crash on an internal test case. > Let me know what you think of the appended. > > thanks, > Tom > > commit bf3507f7fcb6331401f9fd8eb7f1fad25ebfdf23 > Author: Tom Tromey > Date: Tue Apr 16 12:12:09 2019 -0600 > > Avoid crash in dwarf2_init_complex_target_type > > After commit 35add35 ("gdb: Fix failure in gdb.base/complex-parts.exp > for x86-32"), dwarf2_init_complex_target_type can crash if "tt" is > nullptr. This patch avoids the problem by checking for this case. > > No test case because I don't know a good way to write one; it was > found by an internal AdaCore test case that apparently uses a 16 bit > floating point type. > > gdb/ChangeLog: > * dwarf2read.c (dwarf2_init_complex_target_type): Check "tt" > against nullptr before use. > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index ba1300d57ef..9281d822ade 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,8 @@ > +2019-04-16 Tom Tromey > + > + * dwarf2read.c (dwarf2_init_complex_target_type): Check "tt" > + against nullptr before use. > + > 2019-04-15 Leszek Swirski > > * amd64-tdep.c (amd64_classify_aggregate): Use cp_pass_by_reference > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c > index 0873028e438..16bf2404a21 100644 > --- a/gdb/dwarf2read.c > +++ b/gdb/dwarf2read.c > @@ -17566,7 +17566,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu, > /* If the type we found doesn't match the size we were looking for, then > pretend we didn't find a type at all, the complex target type we > create will then be nameless. */ > - if (TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits) > + if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits) > tt = nullptr; > > const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt); Thank you, that looks great. Feel free to push this. Andrew