public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gdcproject.org>
To: gcc-patches@gcc.gnu.org, "Martin Liška" <mliska@suse.cz>
Subject: Re: [PATCH] Use more ARRAY_SIZE.
Date: Thu, 05 May 2022 14:58:15 +0200	[thread overview]
Message-ID: <1651754853.85hnr42bjs.astroid@pulse.none> (raw)
In-Reply-To: <b22b8d81-4340-b107-1949-916b7436c77e@suse.cz>

Excerpts from Martin Liška's message of Mai 5, 2022 2:16 pm:
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/d/ChangeLog:
> 
> 	* longdouble.h: Use ARRAY_SIZE.
> 
> diff --git a/gcc/d/longdouble.h b/gcc/d/longdouble.h
> index 1e457ae04d6..2d9695a4309 100644
> --- a/gcc/d/longdouble.h
> +++ b/gcc/d/longdouble.h
> @@ -117,7 +117,7 @@ public:
>  private:
>    /* Including gcc/real.h presents too many problems, so just
>       statically allocate enough space for REAL_VALUE_TYPE.  */
> -  long realvalue[(2 + (16 + sizeof (long)) / sizeof (long))];
> +  long realvalue[(2 + (16 + ARRAY_SIZE (long))];
>  };
>  
>  /* Declared, but "volatile" is not required.  */
> 

Hi,

This D front-end change doesn't look right to me, besides the slight
difference in parentheses meaning the calculation would be off by some
measure - (2 + (16 + N) / N) => 7 vs. (2 + 16 + N) => 22 - if I
understand the ARRAY_SIZE macro correctly, it wouldn't even generate
valid code either.

Regards,
Iain.

  reply	other threads:[~2022-05-05 12:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 12:16 Martin Liška
2022-05-05 12:58 ` Iain Buclaw [this message]
2022-05-05 14:29   ` Martin Liška
2022-05-09 12:03     ` Richard Biener
2022-05-11  8:17       ` Martin Liška
2022-05-12  9:26         ` Mikael Morin
2022-05-16  8:39         ` Martin Liška
2022-05-17 19:03           ` [committed] Revert 'Use more ARRAY_SIZE.' for mkoffload (was: [PATCH] Use more ARRAY_SIZE.) Tobias Burnus
2022-05-18  7:40             ` Martin Liška
2022-05-23  7:56         ` [PATCH] Use more ARRAY_SIZE Iain Buclaw
2022-05-23 11:57           ` Martin Liška
2022-05-09 10:21 ` Arnaud Charlet
2022-05-09 10:53   ` Martin Liška
2022-05-09 11:00     ` Arnaud Charlet
2022-05-11 13:52 ` David Malcolm
2022-05-11 19:04   ` Eric Gallager
2022-05-11 19:59     ` David Malcolm
2022-05-12  7:08       ` Richard Biener

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=1651754853.85hnr42bjs.astroid@pulse.none \
    --to=ibuclaw@gdcproject.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).