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 c/109450] New: Wrong code for VLA in struct sithe size expression
Date: Sat, 08 Apr 2023 09:21:38 +0000	[thread overview]
Message-ID: <bug-109450-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109450
           Summary: Wrong code for VLA in struct sithe size expression
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

The following code should return 1 but returns two. 

int bar(int n, struct foo* x)
{
        int a = n;
        struct foo { char buf[n++]; }* p = x;
        return a;
}

int main()
{
    return bar(1, 0);
}



https://godbolt.org/z/e94dsfhc9


I noticed this when working on a fix for PR107557 and PR108423.

Already affects 4.7.3 and maybe earlier.

             reply	other threads:[~2023-04-08  9:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  9:21 muecker at gwdg dot de [this message]
2023-04-09  2:20 ` [Bug c/109450] " pinskia at gcc dot gnu.org
2023-04-09  7:58 ` [Bug c/109450] VLA struct definition vs use in the function declaration muecker at gwdg dot de
2023-05-18 12:55 ` muecker at gwdg dot de
2023-05-23 20:05 ` cvs-commit at gcc dot gnu.org
2023-11-03 20:06 ` uecker at gcc dot gnu.org
2023-11-03 20:06 ` uecker at gcc dot gnu.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-109450-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).