public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "colomar.6.4.3 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/108036] [11/12/13 Regression] Spurious warning for zero-sized array parameters to a function
Date: Fri, 09 Dec 2022 19:18:03 +0000	[thread overview]
Message-ID: <bug-108036-4-K3G449D1ce@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108036-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108036

--- Comment #3 from Alejandro Colomar <colomar.6.4.3 at gmail dot com> ---
Hi Andrew!

Just a few nitpicks:

-  In the first testcase you posted, the [] is missing the 0: [0].

-  In the reduced test case, you call the pointer to one past the end as 'end'.
 That is misleading, since 'end' is commonly also used for pointers to the last
byte in an array, normally the NUL byte in strings.  Using the term 'end'
meaning one-past-the-end is likely to end up in off-by-one errors.  So much
that I found a few of them for exactly that reason this week :)

This last point is why I like using array syntax, so I can clrealy specify
'end[1]' and 'past_end[0]', and they are clearly different things.

Cheers,

Alex

  parent reply	other threads:[~2022-12-09 19:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 17:24 [Bug c/108036] New: " colomar.6.4.3 at gmail dot com
2022-12-09 19:09 ` [Bug c/108036] " pinskia at gcc dot gnu.org
2022-12-09 19:13 ` [Bug middle-end/108036] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-12-09 19:13 ` pinskia at gcc dot gnu.org
2022-12-09 19:18 ` colomar.6.4.3 at gmail dot com [this message]
2022-12-09 19:22 ` pinskia at gcc dot gnu.org
2022-12-09 19:23 ` colomar.6.4.3 at gmail dot com
2022-12-21 11:45 ` rguenth at gcc dot gnu.org
2023-05-29 10:07 ` [Bug middle-end/108036] [11/12/13/14 " jakub at gcc dot gnu.org
2024-03-07 10:18 ` daniel.lundin.mail at gmail dot com
2024-03-07 10:53 ` alx at kernel dot org

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=bug-108036-4-K3G449D1ce@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).