public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109450] New: Wrong code for VLA in struct sithe size expression
@ 2023-04-08  9:21 muecker at gwdg dot de
  2023-04-09  2:20 ` [Bug c/109450] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: muecker at gwdg dot de @ 2023-04-08  9:21 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-03 20:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-08  9:21 [Bug c/109450] New: Wrong code for VLA in struct sithe size expression muecker at gwdg dot de
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

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).