From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26776 invoked by alias); 14 Apr 2014 13:10:49 -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 26763 invoked by uid 89); 14 Apr 2014 13:10:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 14 Apr 2014 13:10:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 23D1511616E; Mon, 14 Apr 2014 09:10:45 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LsSyWItI8B+o; Mon, 14 Apr 2014 09:10:45 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E45D211616D; Mon, 14 Apr 2014 09:10:44 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 611E1E0400; Mon, 14 Apr 2014 06:10:50 -0700 (PDT) Date: Mon, 14 Apr 2014 13:10:00 -0000 From: Joel Brobecker To: David Blaikie Cc: gdb-patches Subject: Re: [patch] [gdb/testsuite] include a use of the definition of a type to cause clang to emit debug info Message-ID: <20140414131050.GR4250@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-04/txt/msg00255.txt.bz2 On Sat, Apr 12, 2014 at 11:43:40PM -0700, David Blaikie wrote: > Clang has an optimization that causes a the debug info to only include > the declaration of a type if the type is referenced but never used in > a context that requires a definition (eg: pointers are handed around > but never deferenced). > > This patch introduces a variable to one test file to cause clang to > emit the full definition of the type as well as fixing up a related > typo in the test message of the associated expect file. > > Like the difference between GCC and Clang in the emission of unused > static entities, I think this case is also a matter of degrees - both > GCC and Clang implement other similar optimizations* to the one > outlined here and the GDB test suite has managed to pass without > disabling those optimizations in GCC and I hope it's suitable to do > the same for Clang. > > Though admittedly I don't have much of the context of the history of > the testsuite, its priorities/preferences when it comes to > distinguishing testing compiler behavior versus debugger behavior, > etc. > > * the one I know of involves dynamic types: both GCC and Clang only > emit the debug info definition of such a type in any translation unit > that emits the key function. This means in many contexts where a full > definition is provided in the source only a declaration is provided in > the debug info. > commit 1128f6fb45483d45668d09e0696f4a590334e0c4 > Author: David Blaikie > Date: Sat Apr 12 23:27:19 2014 -0700 > > Cause clang to emit the definition of a type used only by pointer > > gdb/testsuite/ > * gdb.stabs/gdb11479.c: introduce a variable to cause clang to > emit the full definition of type required by the test > * gdb.stabs/gdb11479.exp: correct a typo in a test message The gdb11479.exp is obvious and can be pushed. The change to gdb11479.c, on the other hand, changes the test, and I don't think we want that, because I disagree with the outcome of Clang's optimization here. If Clang doesn't want to fix the problem, best to just xfail the test with Clang, and write a new one that provides the type definition as Clang wants it. Thanks, -- Joel