public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "muecker at gwdg dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/98609] New: sanitizer diagnoses VLAs with length zero although zero-length arrays are a GNU extension
Date: Fri, 08 Jan 2021 21:46:34 +0000	[thread overview]
Message-ID: <bug-98609-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 98609
           Summary: sanitizer diagnoses VLAs with length zero although
                    zero-length arrays are a GNU extension
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

The following code is diagnosed with -fsanitize=undefined:

int main()
{
        int n = 0;
        double x[n];
}


runtime error: variable length array bound evaluates to non-positive value 0


But arrays of zero length are often useful and also generally support by GCC as
an extension. So it would be useful if this would get diagnosed by default. At
least there should be a way to turn this off.

             reply	other threads:[~2021-01-08 21:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 21:46 muecker at gwdg dot de [this message]
2021-01-11  8:15 ` [Bug sanitizer/98609] " marxin at gcc dot gnu.org
2021-01-11  9:04 ` jakub at gcc dot gnu.org
2021-01-11  9:11 ` muecker at gwdg dot de
2021-01-11  9:19 ` jakub at gcc dot gnu.org
2021-01-11  9:24 ` marxin at gcc dot gnu.org
2021-01-11  9:30 ` jakub at gcc dot gnu.org
2021-01-11  9:42 ` marxin at gcc dot gnu.org
2021-01-11 17:58 ` msebor at gcc dot gnu.org
2023-07-30 10:15 ` muecker at gwdg dot de

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-98609-4@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).