From: Ian Lance Taylor <ian@airs.com>
To: Iain Buclaw <ibuclaw@gdcproject.org>
Cc: Alan Modra <amodra@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: ubsan: d-demangle.c:214 signed integer overflow
Date: Mon, 07 Sep 2020 10:46:33 -0700 [thread overview]
Message-ID: <m3mu21fpja.fsf@pepe.airs.com> (raw)
In-Reply-To: <1599495434.jv2yj3bzch.astroid@galago.none> (Iain Buclaw's message of "Mon, 07 Sep 2020 18:17:48 +0200")
Iain Buclaw <ibuclaw@gdcproject.org> writes:
> Excerpts from Alan Modra's message of September 7, 2020 2:56 am:
>> On Fri, Sep 04, 2020 at 06:23:10PM +0200, Iain Buclaw wrote:
>>> If we're already using limits.h, I guess it should be fine to also add
>>>
>>> #define UINT_MAX ((unsigned) ~0U)
>>
>> Yes, except that I'll use the simpler fall-back
>> #define UINT_MAX (~0U)
>>
>> The habit of using a cast for unsigned constants dates back to K&R C
>> where a U suffix was not valid. For example, from libiberty/strtol.c
>> #define ULONG_MAX ((unsigned long)(~0L))
>>
>> Since the code uses ISO/ANSI C features such as prototypes I think
>> we're OK with a U suffix. And if there's something I'm missing then
>> #define UINT_MAX ((unsigned) ~0)
>> would be correct for K&R.
>>
>>> I'll leave it to your judgement on that though.
>>>
>>> Other than that, OK from me.
>>
>> Do I need an OK from Ian too?
>>
>
> As it only touches D support files, I'd say no.
I agree.
Ian
next prev parent reply other threads:[~2020-09-07 17:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 13:01 Alan Modra
2020-09-03 21:02 ` Iain Buclaw
2020-09-04 0:59 ` Alan Modra
2020-09-04 11:22 ` Iain Buclaw
2020-09-04 13:34 ` Alan Modra
2020-09-04 16:23 ` Iain Buclaw
2020-09-07 0:56 ` Alan Modra
2020-09-07 16:17 ` Iain Buclaw
2020-09-07 17:46 ` Ian Lance Taylor [this message]
2020-11-13 19:04 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3mu21fpja.fsf@pepe.airs.com \
--to=ian@airs.com \
--cc=amodra@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=ibuclaw@gdcproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).