From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 161383858C41 for ; Thu, 18 Jan 2024 09:31:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 161383858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 161383858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705570261; cv=none; b=OMS3JUjtB02xWu11PdFC6x7OJ8EvGg62XLwhg95Jh1lyny704MYauPda07lVwg3gjItX7TpHao64mNZLV9tTqREiTE76NvtjRPQB5UQ5H790AIffm9JsnKECnD8if3HTXmwXUDYgczsRpTotr5H1WGjcgyUATlXmcIAwP8LqOUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705570261; c=relaxed/simple; bh=auZgBd8D1LGE/15HLIpdYXvTPb+p/0diGrFdr2ldXv0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Fs9wbIYUhlMtsurecrcvzZ+s0EYLRdgR2bvlgrfENaLHmeTob9IW+m3CoVt/JpKq0q28tNB18z8cz7RPr9fivAwbs//QgkMAF7BKU5hkUospwevQWwHYzsUfSyoRF6S1aEx220o6INKiYcnPrhw3HPXNm+Zep7QAf7dQSjFge1U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-36198fc846fso4226025ab.2 for ; Thu, 18 Jan 2024 01:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1705570259; x=1706175059; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=aRtg4wisNtPz58EJUb2ExwWSBBVmEPXdvm2y+gBI7is=; b=MWxWXp0r75KoDWuVzmQNrM2P7Q1Sh739PAXgUKqOxM4Nwt8Z4HljT3fKP2bKlZUsbE Ryx6pnnopyYkexAW6XqDWBPTYuVfCYqZccIBfraT9bxP8pfQAfzgkqFh13DWZyg1LDA/ fdvStr9m9D0jzAbqfh4JmnXJ606UP48J8buN6SWyMW0WnCnKSeOACBOXb1kfodPNJTYo WU9aUn16x/tEgId/nKvKyUGfhkzjMtpI4kXx2moFwsvRJKqVlYDr3lOmOmhY7b7ygrrh n111dzyRLDFaJI0QAUPaFWtQEEzNLOSGQUMt+4dZYbR4QcV6jx5pBVZH6rWD7lYdqpci tE3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705570259; x=1706175059; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aRtg4wisNtPz58EJUb2ExwWSBBVmEPXdvm2y+gBI7is=; b=wUfzUwxLpx2mkqoYpM6O4jGbR0jm36tA0D3CU3yt2EkRs6UKq2e5gatXLeY3aWwztc dS8Sk6Ut0IJPBFGZ3i8cUZOGwBD05Jaa3+p8a7UgKwK5SqbErfGfrczZVcRKT/IMiqEK jWk3HnqGi04iVXiCWmDxyQWSIwaisZV+r4YwlvoKMXGkSt0+nxfr70rLfHT0mtyOJ+y4 rnSePwTq2zYQIUrzBntNlTtXoYMOpync8O4NdvpUGq9j/LOT3EbM4fEZZt8UWvaPIABf vBYrKOWWGr5335a2n9q9IoRFnJXVbun/8/o69rB/u2HlFq3Ip4YD+0apogzbiEAw0uuZ v48Q== X-Gm-Message-State: AOJu0Yy/CzIu8A3iQLz3v4TuC4uRWW9eRQBN0BXqzspK0T4/lR/akgXc BZuM3hySsCi9+ESUTBzZz2ON86z9xxw3NpzS5xBxMXJvZ3tMaoGrk8zy5Rjk3Q== X-Google-Smtp-Source: AGHT+IEqo63mKYAyD4rs5ZqCodROMZmmYOWjo97ZF2l8PTfYfjFpumaPmnBdpeWXYMAQ1VNet3Bdjw== X-Received: by 2002:a92:db4a:0:b0:361:9463:34dd with SMTP id w10-20020a92db4a000000b00361946334ddmr609321ilq.58.1705570259174; Thu, 18 Jan 2024 01:30:59 -0800 (PST) Received: from ?IPV6:2a04:cec0:1900:a7b4:6d7d:787f:a3f7:cd7? ([2a04:cec0:1900:a7b4:6d7d:787f:a3f7:cd7]) by smtp.gmail.com with ESMTPSA id e9-20020a056e0204a900b0035feab4a296sm4643541ils.8.2024.01.18.01.30.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jan 2024 01:30:58 -0800 (PST) Message-ID: <7b53ee9e-1830-4878-9e12-b3e748a2e4fd@embecosm.com> Date: Thu, 18 Jan 2024 11:30:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing. Content-Language: en-US To: Rainer Orth Cc: gcc-patches@gcc.gnu.org, gcc-rust@gcc.gnu.org References: <20240118090056.2910410-2-arthur.cohen@embecosm.com> From: Arthur Cohen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: Hi Rainer, On 1/18/24 10:13, Rainer Orth wrote: > Arthur Cohen writes: > >> Using %lu to format size_t values breaks 32 bit targets, and %zu is not >> supported by one of the hosts GCC aims to support - HPUX > > But we do have uses of %zu in gcc/rust already! > >> diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc >> index e8618485b71..09680733e98 100644 >> --- a/gcc/rust/expand/rust-proc-macro.cc >> +++ b/gcc/rust/expand/rust-proc-macro.cc >> @@ -171,7 +171,7 @@ load_macros (std::string path) >> if (array == nullptr) >> return {}; >> >> - rust_debug ("Found %lu procedural macros", array->length); >> + rust_debug ("Found %lu procedural macros", (unsigned long) array->length); > > Not the best way either: array->length is std::uint64_t, so the format > should use > > ... %" PRIu64 " procedural... > > instead. > > I've attached my patch to PR rust/113461. Yes, I was talking about this on IRC the other day - if we do run in a situation where we have more than UINT32_MAX procedural macros in memory we have big issues. These debug prints will probably end up getting removed soon as they clutter the output a lot for little information. I don't mind doing it the right way for our regular prints, but we have not been using PRIu64 in our codebase so far, so I'd rather change all those incriminating format specifiers at once later down the line - this patch was pushed so that 32bit targets could bootstrap the Rust frontend for now. Best, Arthur > Rainer >