From patchwork Tue Nov 20 17:28:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 200488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E932A2C0079 for ; Wed, 21 Nov 2012 04:28:51 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354037332; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=EBrUMIq ivh2rd9+J0UoCzc6+c4s=; b=d0E3nWhdv+yZXAor1LnBkIaHLigY/mqnkGgejQx /QO5lCn5ouXTNWdVxS3PiNR4sueMpq/asi89lfq8z4hQJ7ZkbfKw3uNQVFcZZK7e cHWBKZDzT3R8pNfOdotdy0UJbj7V4M9fvpQYaubGmG7W6aQrfDs4w/j0R/OLKDyn OnnU= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=yN5Mug8w/+JfTLO4NqAAuFyOi1/qWioRz+44mt6QGOxq0Y3dTxCbpXYwGuyurq w/21z1kqyZj/zPsSRvARwW778Hh3VJc0sRDV7cz+WvDSRGb/0NE86WpQrQhwGMQs 2jx0I8TKG12SfYtI8YV6GbmerUcOMBi480rUJv/b7xyBM=; Received: (qmail 10865 invoked by alias); 20 Nov 2012 17:28:26 -0000 Received: (qmail 10750 invoked by uid 22791); 20 Nov 2012 17:28:23 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Nov 2012 17:28:12 +0000 Received: by mail-pa0-f47.google.com with SMTP id fa11so4070704pad.20 for ; Tue, 20 Nov 2012 09:28:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=fZOO9Xyahy1OvZ7qEINuro5I506cPxvXx+iiHvLc7N0=; b=lA/sGI/FmgS3GcVAfU+GS61fzn/lQvBBEPBIgcEPASPh1RfzFV57JxM6UJLmBZZ30S dkBNy7uSmy4aU/KWa+OoGlE1Yhz2cooIk+V9YtiRxzc5M03GDbQUQuqVqwdSJrc1dnGI iAoGYf/ZEzpCLDV89BN+2fOq5uhpud7Qfycmes6pEGJzLExMpSO7XhgD7X+ugIB/+0yN UYmOhxJGjizMbHP0+WgtjTKX4a9EsH1EOdUQfD+eHCegPZBaibaV2z+arbkvp7Y9iW0/ jkfd3Wysu/hC2nd9TaNbIhEZDh+yAzqqpgjUPyYor/YJ7rPKM3CBBJz1RiZjzdrGXNrG pKLw== Received: by 10.68.234.98 with SMTP id ud2mr45107724pbc.136.1353432492258; Tue, 20 Nov 2012 09:28:12 -0800 (PST) Received: from coign.google.com ([2620:0:1000:1804:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id wf8sm8362275pbc.65.2012.11.20.09.28.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 09:28:11 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: libbacktrace patch committed: Always clear union in read_attribute Date: Tue, 20 Nov 2012 09:28:09 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnLWrSevQgwdAvxix8twoUythYE+Kj3E5QGuAujMalaCgjqfOHQ3OsDU9mnVADn4K2wbMWPw9McKpx/LxWo14KivPR8kcbbgbdCjN+A3VoZ4ucJID3YgHb66NQTUR0zS2KBNR6TGMkinaPVmKupjI8SLC3H6RpBv4jZzwf4jxIn73lSdV8o9FSM0OieJqk0l3guMkflZX+MMTa+53Mw10lecLadrg== X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org http://gcc.gnu.org/ml/gcc-regression/2012-11/msg00279.html points out a may-be-used-uninitialized warning, turned into an error, when building libbacktrace. The warning is incorrect: the value is initialized. The warning will no longer turn into an error. But it is easy enough to force an initialization to avoid the warning. That is what this patch does. Bootstrapped and ran libbacktrace testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2012-11-20 Ian Lance Taylor * dwarf.c (read_attribute): Always clear val. Index: dwarf.c =================================================================== --- dwarf.c (revision 193484) +++ dwarf.c (working copy) @@ -654,6 +654,12 @@ read_attribute (enum dwarf_form form, st const unsigned char *dwarf_str, size_t dwarf_str_size, struct attr_val *val) { + /* Avoid warnings about val.u.FIELD may be used uninitialized if + this function is inlined. The warnings aren't valid but can + occur because the different fields are set and used + conditionally. */ + memset (val, 0, sizeof *val); + switch (form) { case DW_FORM_addr: