Received: by 2002:a05:6512:e9d:0:0:0:0 with SMTP id bi29csp6426085lfb; Mon, 28 Mar 2022 03:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQrSVzHMmbOfdg8fwh9Vht2bYBnhv3sSZmXoK+zr0CtDxgsIExOFv0L6aURRq7xijW1bUT X-Received: by 2002:ac8:7f16:0:b0:2e2:11d9:f4cb with SMTP id f22-20020ac87f16000000b002e211d9f4cbmr20768453qtk.196.1648465076996; Mon, 28 Mar 2022 03:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648465076; cv=none; d=google.com; s=arc-20160816; b=adc8I17jUQIVSNWIHQTenVhucppujnnNcgKkceZavZAlXNptBAdgzvNT6wmn1Z4qXw vJRJ8ONpoGfm+mtHIUICHjIB1XMBAsmT1Zq0qG4MdJf5qvkrX04gORc5c77mS4fsGljf Ma8ldZV1AwjQ9BGo4SFpjlzYZt9pRi2VMoOAVNY5ByRIgvc0bw2WTx6dqwj6mRHqvWjP FTJtdblCDsCJZBiPWXAQe9EXjKUZhWAzcKCLxbbtKGSkYwiwIPo8K65/YLptk/ncViEg 8HZC2epBfn4ReRLkJfD869sOFuwkGTPtsCU9IRjxuzgQj80W0EJhmaAJf9fojRna4Ola Pnzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:from:references:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=ghqeZEwi/n6kn/kYh/eh/XOrtc7gnJ3oZxOtRFslmCI=; b=JEV2B+S8ls70E5gt/YrlJaFmwYWJ/CD84gcNo6CVTN2q+YhpD2qGVHVPIvLlKF3NeJ h2H+JtmMT4+m/4inDS/M4gjULwVdfsQ4+L0KeQD3yixtKzT9LJ+HZYNZJQIy6W1et76M MXCBM0dobLdedG8qbWLo1j24WuhIp58WKvHyf9CinYVmLccMcHu+e3F8M7O5aly1gJXT trHkzHsWBZukMpqul4Jv0Yd2Xgv/JE2p3dA2vwYt823HOGSIZtcPL3RkITpdUWN2Rx3m +ZsPpTZoUmJ9/k3XESJmexuHEKJDbRswUtt5aSUNB+iixlM1NntvCQefz0GPnxM3LbAL 4xJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hPpjZFlx; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2-20020ac84b42000000b002e1fbf3bedcsi4969325qts.205.2022.03.28.03.57.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Mar 2022 03:57:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hPpjZFlx; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:57574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYn4O-0002Qi-Ho for alex.bennee@linaro.org; Mon, 28 Mar 2022 06:57:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYn41-0002QM-0P for qemu-arm@nongnu.org; Mon, 28 Mar 2022 06:57:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYn3z-0006WM-4G for qemu-arm@nongnu.org; Mon, 28 Mar 2022 06:57:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648465050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ghqeZEwi/n6kn/kYh/eh/XOrtc7gnJ3oZxOtRFslmCI=; b=hPpjZFlxmdwDRJRaFWCmLaczbcTHiB2qvwYpAmPzUGOnyMIe4p1xPMGf+ZNPDkcqDWkiYI bo5qnCVCpZAOkyCu19yCqpF0RgJ6eLGE77Ikp26WZ/0vHKxKzwQrJ+VDGOgwSBSFs4bFAy LmqVUrOKCaN5dukJVKQ3ld7WWYb46qI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-177-F6LKutgqPJCP9hPh62CYYA-1; Mon, 28 Mar 2022 06:57:25 -0400 X-MC-Unique: F6LKutgqPJCP9hPh62CYYA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD555101A54C; Mon, 28 Mar 2022 10:57:24 +0000 (UTC) Received: from [10.39.194.130] (unknown [10.39.194.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7BAC40CF8E8; Mon, 28 Mar 2022 10:57:22 +0000 (UTC) Message-ID: Date: Mon, 28 Mar 2022 12:57:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH 5/5] s390x/tcg: fix format-truncation warning To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= References: <20220328084717.367993-1-marcandre.lureau@redhat.com> <20220328084717.367993-6-marcandre.lureau@redhat.com> From: Thomas Huth In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Igor Mitsyanko , Cornelia Huck , Richard Henderson , qemu-devel , Beniamino Galvani , "open list:S390 SCLP-backed..." , qemu-arm , Antony Pavlov , Stefan Hajnoczi Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: wdvHF4KQTc8N On 28/03/2022 12.22, Marc-André Lureau wrote: > Hi > > On Mon, Mar 28, 2022 at 12:59 PM Thomas Huth wrote: >> >> On 28/03/2022 10.47, marcandre.lureau@redhat.com wrote: >>> From: Marc-André Lureau >>> >>> ../target/s390x/tcg/translate.c: In function ‘s390x_translate_init’: >>> ../target/s390x/tcg/translate.c:224:64: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 3 [-Werror=format-truncation=] >>> 224 | snprintf(cpu_reg_names[i], sizeof(cpu_reg_names[0]), "r%d", i); >>> | ^~ >>> >>> Signed-off-by: Marc-André Lureau >>> --- >>> target/s390x/tcg/translate.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c >>> index 5acfc0ff9b4e..a082342a0424 100644 >>> --- a/target/s390x/tcg/translate.c >>> +++ b/target/s390x/tcg/translate.c >>> @@ -199,7 +199,7 @@ static TCGv_i64 regs[16]; >>> >>> void s390x_translate_init(void) >>> { >>> - int i; >>> + size_t i; >>> >>> psw_addr = tcg_global_mem_new_i64(cpu_env, >>> offsetof(CPUS390XState, psw.addr), >>> @@ -221,7 +221,7 @@ void s390x_translate_init(void) >>> "cc_vr"); >>> >>> for (i = 0; i < 16; i++) { >>> - snprintf(cpu_reg_names[i], sizeof(cpu_reg_names[0]), "r%d", i); >>> + snprintf(cpu_reg_names[i], sizeof(cpu_reg_names[0]), "r%zu", i); >> >> The compiler is *really* too stupid to see that i is in the range between 0 >> and 16 here??? ... that rather sounds like a compiler bug to me than >> something that we should work-around in the QEMU source code. Considering >> that you're using a x.0 release of GCC, please file a bug against GCC >> instead. If they refuse to fix it for GCC 12.1 or later, we can revisit this >> patch, but currently, I really think this should be fixed in GCC instead. >> > > I opened: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105080 > > Although I think the "workaround" is simple and would avoid users & > distributions having to add --disable-werror, and possibly miss other > issues. But I really dislike adding such noise to the history (it spoils "git blame" for example) if it is not really necessary. In this case, it also rather helps to show distros that they are shipping a buggy compiler and they should fix their compiler instead before it hits their users. So I think it would be rather bad to fix this in QEMU now. Thomas