From patchwork Sat Jun 13 08:08:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1308609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ydlwI9UC; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49kVbJ0sbZz9sQx for ; Sat, 13 Jun 2020 18:08:26 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 681263945C1A; Sat, 13 Jun 2020 08:08:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 681263945C1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592035700; bh=+omnGXiZBPOMh5aVhtQRcMCwhspq3DHBb+IiOHD8eKU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ydlwI9UCXWKCTlgSCE5NK1o+snz4bGzEOihlQjwwf6U+Nz4RlEaxE2TAUEck+nNCo hbimBbKB1+sFuOO2/4UJoJnRct4v5jfz7mU37qCbrvz5eg8HkgF+rtBXZKYGeuq51I 9uj4O3GCSCg2taLcot7XfrW/6cUieHuSvNzITzW4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cc-smtpout2.netcologne.de (cc-smtpout2.netcologne.de [IPv6:2001:4dd0:100:1062:25:2:0:2]) by sourceware.org (Postfix) with ESMTPS id 6CF443851C18; Sat, 13 Jun 2020 08:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6CF443851C18 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id A9587128B6; Sat, 13 Jun 2020 10:08:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id AE9F411F00; Sat, 13 Jun 2020 10:08:15 +0200 (CEST) Received: from [2001:4dd6:36e3:0:5b1c:29fc:15e7:fe34] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.11.6) (envelope-from ) id 5ee4896f-4f6f-7f0000012729-7f000001dc02-1 for ; Sat, 13 Jun 2020 10:08:15 +0200 Received: from linux-p51k.fritz.box (2001-4dd6-36e3-0-5b1c-29fc-15e7-fe34.ipv6dyn.netcologne.de [IPv6:2001:4dd6:36e3:0:5b1c:29fc:15e7:fe34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sat, 13 Jun 2020 10:08:14 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, libfortran, committed] Suppress -Wstringop-overflow warning Message-ID: Date: Sat, 13 Jun 2020 10:08:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: de-DE X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thomas Koenig via Gcc-patches From: Thomas Koenig Reply-To: Thomas Koenig Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, I just committed as obvious the patch below. Disable -Wstringop-overflow warning after checking code path of caller. The warning that is disabled, only on this single line, has been inspected and found to be not applicable; it is known that the size of the buffer is safe. libgfortran/ChangeLog: 2020-06-13 Thomas Koenig PR libfortran/95313 * io/write.c (ztoa_big): Disable -Wstringop-overflow for one line. diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 9f02683a25c..346615ed597 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1178,7 +1178,15 @@ ztoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n) } } + /* write_z, which calls ztoa_big, is called from transfer.c, + formatted_transfer_scalar_write. There it is passed the kind as + argument, which means a maximum of 16. The buffer is large + enough, but the compiler does not know that, so shut up the + warning here. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" *q = '\0'; +#pragma GCC diagnostic pop if (*n == 0) return "0";