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

            Bug ID: 96565
           Summary: Failure to optimize out VLA even though it is left
                    unused
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

bool g(void);

void f(int x)
{
    char arr[x];

    arr[0] = 0;

    if (g())
        abort();
}

The VLA can be removed. This transformation is done by LLVM, but not by GCC.

Reply via email to