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 via email to