From patchwork Mon Dec 3 09:51:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 203303 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 B18812C0084 for ; Mon, 3 Dec 2012 20:55:15 +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=1355133316; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=j28J0HxerJ7vWNhHW/hNiWvsZK4=; b=QQ89tKzz4H8JfOn veKHkqCQw6sYpWgur1JFjjXs1hn65lUfplesUu0lB3gbCAylMCpjMX2+XIRX7GoJ Kqe8GnjOFMfqLfFEoecPWTbuhVMwXf3vQd8kYRjJ8pFenR1XnLHzLRCW7icZwaYh pJqieaPYY9lSIo1rqBi6hsxJsQAY= 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:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ZOSt3BPy3/ZaG3ZPsC6QzLbMd3WnfBN3tfTWwaaHKSSeVPrJDDyLV85Yod38BI SmIlLduiwicV0bGWM8kQga/tMJfwB32y7AYe8PRVXLOiGTw5ziCrCd46jkEJ/hNi 0EfgTeJVADWkaH9d6oQ7rmI/+NI/v7pt4hzq+B4tDa2aE=; Received: (qmail 23357 invoked by alias); 3 Dec 2012 09:55:07 -0000 Received: (qmail 23339 invoked by uid 22791); 3 Dec 2012 09:55:05 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Dec 2012 09:54:57 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5D760CB2CD4 for ; Mon, 3 Dec 2012 10:55:00 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SM0UKGJ6lJ8P for ; Mon, 3 Dec 2012 10:55:00 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B2E0ACB2CD3 for ; Mon, 3 Dec 2012 10:54:59 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Small tweak to -Wuninitialized Date: Mon, 03 Dec 2012 10:51:51 +0100 Message-ID: <2617259.JYs7QYuLy2@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 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 Hi, if you compile the attached testcase on x86 with -O2 -Wuninitialized, you get: strip.adb: In function 'Strip': strip.adb:4:4: warning: 'Last' may be used uninitialized in this function [- Wuninitialized] strip.adb:26:44: warning: 'First' may be used uninitialized in this function [-Wmaybe-uninitialized] The same warning is apparently associated with 2 different options so, if you want to disable "maybe" warnings, -O2 -Wuninitialized -Wno-maybe-uninitialized only disables the second one: strip.adb: In function 'Strip': strip.adb:4:4: warning: 'Last' may be used uninitialized in this function [- Wuninitialized] Of course the story under the hood is a bit different, but this doesn't really matter to the user I think, so I propose using the -Wmaybe-uninitialized tag in both cases. Tested on x86-64-suse-linux, OK for the mainline? 2012-12-03 Eric Botcazou * tree-ssa.c (warn_uninitialized_var): Use OPT_Wmaybe_uninitialized tag in the non-always executed case. Index: tree-ssa.c =================================================================== --- tree-ssa.c (revision 194049) +++ tree-ssa.c (working copy) @@ -1664,7 +1664,7 @@ warn_uninitialized_vars (bool warn_possi "%qD is used uninitialized in this function", stmt); else if (warn_possibly_uninitialized) - warn_uninit (OPT_Wuninitialized, use, + warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use), SSA_NAME_VAR (use), "%qD may be used uninitialized in this function", stmt); @@ -1696,13 +1696,13 @@ warn_uninitialized_vars (bool warn_possi continue; if (always_executed) - warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt), - base, + warn_uninit (OPT_Wuninitialized, use, + gimple_assign_rhs1 (stmt), base, "%qE is used uninitialized in this function", stmt); else if (warn_possibly_uninitialized) - warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt), - base, + warn_uninit (OPT_Wmaybe_uninitialized, use, + gimple_assign_rhs1 (stmt), base, "%qE may be used uninitialized in this function", stmt); }