Message ID | ZcsfSfCribhs0tkW@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp383007dyb; Mon, 12 Feb 2024 23:51:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULkFjZGWM1fFNDTP8wv5f21Vb+0KMtPfgtDf/8fsdb5Z2QjTRXsLov6y4tdPCkpsfzTgojcq9Ll4fxcFLEZdDMNmnMBw== X-Google-Smtp-Source: AGHT+IERnCJQHwc/QzieYJb/0kYAO++nssDM7FVgW/7fpfrg9gyzKuTNK+qIADUUgYGPgck87FYX X-Received: by 2002:a67:f790:0:b0:46d:1ec3:9f60 with SMTP id j16-20020a67f790000000b0046d1ec39f60mr6414079vso.11.1707810674226; Mon, 12 Feb 2024 23:51:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707810674; cv=pass; d=google.com; s=arc-20160816; b=DnKP1BLtEA6le3p59+chi+/GQbnD7x0AoeopEF7dBufANga1CSiCFHx/mwCUFiIDD8 NNzK+OYkGKJpqETSLsb2sCw+mEa23ODX1OUdu+/t42FnV0h8KGCVx/v4+glT3tbv3Hgp 2kLZCRv+WTFE0FWxwh+tPFuKBXg5Ib/X2OkXInY5hgfCS5LLowztssdeVd6VnXvYGJ8t Kvezvg78BER7172MEWyguy+97BLVbQDrawvDRFdAcy6HHBhFEaMqE8JJMH54Y92qzddf k4uM7D672tQ45L4uKjWqNRkdW3T6k35PUUKci9ms+HmdfRfbMGABpMwByJPJHNbgNAOa YoLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gM9HxFh2GBwWCFazpGVIf6HlyylN6f/kjY7hHb6V8z0=; fh=wEUpbu/L3ZuZ4iG58A72kWJOyDEvXQHrGGTNOUPPqmY=; b=ePhdbiKnpPB7FdM34Mob30u0nCzWVwyRNWwvlPm9fhiZ4jK7j6rY3AcHWnrNr2FkhE z5/soOf0jjPAefb3BLWE5yqhFsWfdt7cKgEzhfeCT+/DuPURrzGHgV7diS3o6NH5t13Y TykwlmA+i7iyQ8eRsmiDy+G0B3dcGMwK9sqP1c5kPd/lJjE46EIq10HgqUz2qO+QyXTf 04mowfzoKFjN51HMnpSR38ovK3sOVIHyhHIzq8oHqZSLqEHqJw2+CJElG6qJNHwzj8S4 2Bxq4j4UT9ftkiSPUaoOycqXWSkoHb1HXJ8VzJGtIFTNub+Zpl9Yh3V7Eh5CuEbBSQmT /HYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VNvdtfCv; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCU9al4+DZgEvMjJm2oyKiCiaEWLRS9CXxNoHqxEMc/ZKTY66aaA8lSy7x7R4fy653WQHEz8SK3YD8e03W8hmYdzV9lp2A== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q18-20020a05622a031200b0042c4c6d0371si2437815qtw.481.2024.02.12.23.51.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 23:51:14 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VNvdtfCv; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA71E3858419 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 07:51:13 +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 <gcc-patches@gcc.gnu.org>; 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 <jakub@redhat.com> To: Richard Biener <rguenther@suse.de> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t Message-ID: <ZcsfSfCribhs0tkW@tucnak> 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-Type: text/plain; charset=us-ascii 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790769285757506533 X-GMAIL-MSGID: 1790769285757506533 |
Series |
hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Feb. 13, 2024, 7:50 a.m. UTC
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 <jakub@redhat.com> * 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
Comments
On Tue, 13 Feb 2024, Jakub Jelinek wrote: > 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? OK. > 2024-02-13 Jakub Jelinek <jakub@redhat.com> > > * 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. > > --- 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 > > 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