From patchwork Tue Feb 13 07:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1898086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VNvdtfCv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TYtmh2WsJz20RF for ; Tue, 13 Feb 2024 18:50:58 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 725803858413 for ; Tue, 13 Feb 2024 07:50:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 14A033858C52 for ; Tue, 13 Feb 2024 07:50:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 14A033858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 14A033858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707810640; cv=none; b=nMJziJvXbmEaAoJA5jMxe0KDAjxhSl4VN3rMaIhDOaly5Cu8efocKpC+roCuK5VUWn4xd8mynVBnTRqePkVflV8i6I2P/q/LV8qMEzhH+SgkS6OY31l22IbawJz+M7dyj81aNAxC1DrYcVOW7ThlGrflSGj30tmZIy+WNAmsT8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707810640; c=relaxed/simple; bh=Nc305uHgbJRrdMS66HLT9UiTNAB5xw6ARVRCc1BmVrI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=cEYPgkG/vC9hk4IcyjK4LOySTWt5baZXdWwSm2fGyHpEKLrnjC+rx7TheDI9JmBCT06nMgVH7jgC6IdzU5sB6xA0lSKBSoWnzmG8Xl0vs0yatdvGLgZD0M0gfdnTIcVyPvLwC8+8eDFD1Y6oG/l/UhmT1PK6wmalZQAo4JO1wBo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707810638; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=gM9HxFh2GBwWCFazpGVIf6HlyylN6f/kjY7hHb6V8z0=; b=VNvdtfCvb/jgDyTfXqvvUTLpxnch3s/BUXY6Wjw+2UnWtfY0whLU8lzOWsxqOTN3OD/xNU KtRvJe1a7m4wNEYiOdQ23cDuizGjCWwY1h3ZNumERxVKAgrAHdsXAUZGgMXUOlznRrsCRM 4/8Ryn1Jl3MYxWm5H+YAidR1ww5JRoc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-ph5x3-lyMkiyoOm_9WIwjA-1; Tue, 13 Feb 2024 02:50:37 -0500 X-MC-Unique: ph5x3-lyMkiyoOm_9WIwjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 034BB101A52A; Tue, 13 Feb 2024 07:50:37 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB777C0335E; Tue, 13 Feb 2024 07:50:36 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 41D7oYtd1327425 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 08:50:34 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 41D7oXwf1327424; Tue, 13 Feb 2024 08:50:33 +0100 Date: Tue, 13 Feb 2024 08:50:33 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Using unsigned long long int for fmt_size_t and "ll" for GCC_PRISZ as broke the gengtype on i686-linux before the libiberty fix is certainly unexpected. size_t is there unsigned int, so expected fmt_size_t is unsigned int (or some other 32-bit type). The problem was that I was comparing SIZE_MAX against signed maxima, but SIZE_MAX is unsigned maximum. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-02-13 Jakub Jelinek * hwint.h (GCC_PRISZ, fmt_size_t): Fix preprocessor conditions, instead of comparing SIZE_MAX against INT_MAX and LONG_MAX compare it against UINT_MAX and ULONG_MAX. Jakub --- gcc/hwint.h.jj 2024-02-09 11:59:17.444974906 +0100 +++ gcc/hwint.h 2024-02-12 18:53:51.287281199 +0100 @@ -120,10 +120,10 @@ typedef HOST_WIDE_INT __gcc_host_wide_in So, instead of doing fprintf ("%zu\n", sizeof (x) * y); use fprintf (HOST_SIZE_T_PRINT_UNSIGNED "\n", (fmt_size_t) (sizeof (x) * y)); */ -#if SIZE_MAX <= INT_MAX +#if SIZE_MAX <= UINT_MAX # define GCC_PRISZ "" # define fmt_size_t unsigned int -#elif SIZE_MAX <= LONG_MAX +#elif SIZE_MAX <= ULONG_MAX # define GCC_PRISZ HOST_LONG_FORMAT # define fmt_size_t unsigned long int #else