From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19066 invoked by alias); 26 Apr 2017 22:34:26 -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 19056 invoked by uid 89); 26 Apr 2017 22:34:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Apr 2017 22:34:23 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E2D23DBC2; Wed, 26 Apr 2017 22:34:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2E2D23DBC2 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2E2D23DBC2 Received: from tucnak.zalov.cz (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A693E18A22; Wed, 26 Apr 2017 22:34:23 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v3QMYKCk027692; Thu, 27 Apr 2017 00:34:20 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v3QMYIXa027691; Thu, 27 Apr 2017 00:34:18 +0200 Date: Thu, 27 Apr 2017 05:07:00 -0000 From: Jakub Jelinek To: Joseph Myers Cc: Martin Sebor , Gcc Patch List Subject: Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503) Message-ID: <20170426223418.GV1809@tucnak> Reply-To: Jakub Jelinek References: <055b63b9-2303-6031-021c-c216e94ed072@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg01332.txt.bz2 On Wed, Apr 26, 2017 at 10:26:56PM +0000, Joseph Myers wrote: > On Wed, 26 Apr 2017, Martin Sebor wrote: > > > Testing my solution for bug 77671 (missing -Wformat-overflow > > sprintf with "%s") caused a regression in the charset/builtin2.c > > test for bug 25120 (builtin *printf handlers are confused by > > -fexec-charset). That led me to realize that like -Wformat > > itself, the whole gimple-ssa-sprintf pass is oblivious to > > potential differences between the source character set on > > the host and the execution character set on the target. As > > a result, when the host and target sets are different, the > > pass misinterprets ordinary format characters as special > > (e.g., parts of directives) and vice versa. > > > > The attached patch implements a simple solution to this problem > > by introducing a mapping between the two sets. > > target_strtol10 appears to do no checking for overflow, which I'd expect > would result in nonsensical results for large width values overflowing > host long (whereas strtol would reliably return LONG_MAX in such cases). Also, can't there be a way to shortcut all this processing if the charsets are the same? And is it a good idea if every pass that needs to do something with the exec charset chars caches its own results of the langhook? Jakub