From patchwork Thu May 14 10:39:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 39245 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2EA0395BC17; Thu, 14 May 2020 10:39:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2EA0395BC17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1589452798; bh=9Et9RAIWTqf8J5kcFhgd49QnlCrk3XlEsDsZJtYkE2k=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rk7xznHDBAJMVmhx9LvL7qqTnVFUGCMiZRKCsJE0uJmsGyCLBTK6gnv6gzfXuGkRy egwPzjMQa3KdL/Jx+MdPvIe37j0me6VZC3n3widGGoC3cufOmNK0zB9HpawGFelZFi VLn4De3gXaLn/0nxTt03EROV8e5wGgJdKNwAlbYk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 4B49A395B42B for ; Thu, 14 May 2020 10:39:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B49A395B42B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-lGKtsHQrPl2Yl0XP1agtiA-1; Thu, 14 May 2020 06:39:54 -0400 X-MC-Unique: lGKtsHQrPl2Yl0XP1agtiA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2F411899536 for ; Thu, 14 May 2020 10:39:53 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-174.ams2.redhat.com [10.36.113.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3504F60BF1 for ; Thu, 14 May 2020 10:39:53 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] string: Fix string/tst-memmove-overflow to compile with GCC 7 Date: Thu, 14 May 2020 12:39:51 +0200 Message-ID: <87zhaayf48.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" GCC 8 relaxed what kind of expressions can be used in initializers, and the previous use of static const variables relied on that. Switch to wide (non-int) enum constants instead, which is another GCC extension that is more widely implemented. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- string/tst-memmove-overflow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/string/tst-memmove-overflow.c b/string/tst-memmove-overflow.c index 77d693d0dd..ffbcd04308 100644 --- a/string/tst-memmove-overflow.c +++ b/string/tst-memmove-overflow.c @@ -42,11 +42,11 @@ IMPL (memmove, 1) /* Size of the part of the allocation which is not shared, at the start and the end of the overall allocation. 4 MiB. */ -static const size_t unshared_size = 4U << 20; +enum { unshared_size = (size_t) 4U << 20 }; /* The allocation is 2 GiB plus 8 MiB. This should work with all page sizes that occur in practice. */ -static const size_t allocation_size = (2U << 30) + 2 * unshared_size; +enum { allocation_size = ((size_t) 2U << 30) + 2 * unshared_size }; /* Compute the expected byte at the given index. This is used to produce a non-repeating pattern. */