From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2543 invoked by alias); 24 Feb 2017 17:51:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 2530 invoked by uid 89); 24 Feb 2017 17:51:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=recommendation X-HELO: mail-qk0-f175.google.com Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Feb 2017 17:51:53 +0000 Received: by mail-qk0-f175.google.com with SMTP id n127so24962003qkf.0 for ; Fri, 24 Feb 2017 09:51:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/35cN4U+oR71MYE0LrAyCfGe8WpmJ0meM+DTXKDxNa8=; b=n+EoGR7HbXhDXhv/2L1XRUXt0gYsdsqoeHuKGTGvWQOeB0VOYVTqe7CJ9SKmQ7D1ko d4b1At6Gwv4EyhdVWld1GeTCSQvUzOkNbsnN2aQFQn9QU8sNw8JykHWyOKdsZpTXNdEt rbUA/uVIn0nMjxkXF47It52BDpp4Hl2baTu9mNqowPB7zV+leJGjjDFxCrrNAg8Ajm+J evslFa7N6vStDI7cfHHw9xbRkJCvOa1dwdlShqy3oR2fkxiCaYgBE3zmLKSfno4tVFlO LtFYkK4eqMHPt7mth5lTJHMlqxPe6PUH0lgnp863E5D5SNEOqRyXm6YTCiiBjt2EuHxt kseA== X-Gm-Message-State: AMke39k5MFsmJspFL61NVHcZv4QC+VpWS/xPa2/N2U+rREfUMGk62f23x18gpBwtxlXQ3w== X-Received: by 10.55.47.4 with SMTP id v4mr3963036qkh.77.1487958712088; Fri, 24 Feb 2017 09:51:52 -0800 (PST) Received: from [192.168.0.3] (75-166-126-106.hlrn.qwest.net. [75.166.126.106]) by smtp.gmail.com with ESMTPSA id t124sm5193533qkf.27.2017.02.24.09.51.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:51:51 -0800 (PST) Subject: Re: enable -Wformat-truncation with -Og (PR 79691) To: Richard Biener References: Cc: Gcc Patch List From: Martin Sebor Message-ID: Date: Fri, 24 Feb 2017 18:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg01510.txt.bz2 On 02/24/2017 03:10 AM, Richard Biener wrote: > On Fri, Feb 24, 2017 at 1:35 AM, Martin Sebor wrote: >> Bug 79691 - -Wformat-truncation suppressed by (and only by) -Og >> points out that the gimple-ssa-sprintf pass doesn't run when >> this optimization option is used. That's because I forgot to >> add it to the set of optimization passes that run with that >> option. The attached trivial patch tested on x86_64 corrects >> the oversight. >> >> Is this okay for 7.0? > > Any reason for the placement before copy-prop? I'd have done it > after pass_late_warn_uninitialized for example. I wanted to make sure that folded sprintf return values would be eligible for further copy propagation. E.g., that a + b would be folded into a constant: int foo (void) { int a = snprintf (0, 0, "%i", 123); int b = snprintf (0, 0, "%i", 1234); return a + b; } But I could have easily missed some important use case where this placement will compromise the warning. I don't have any tests for this one way or the other so I'm happy to go with your recommendation. Let me know which you think is more appropriate (if you have a suggestion for a test case I'd be grateful). > > Also doesn't pass_sprintf_length rely on get_range_info ()? With -Og > nothing populates those so you'll always get effectively VARYING ranges. It does when it's available but as Jakub noted, it works without it as well (at -O0). Thanks Martin