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

--- Comment #2 from sasho648 at gmail dot com ---
Must be noted that such code must be valid and actually currently working fine
and as expected when the function is not nested. Eg.:

#include <stdio.h>

extern void fp(int a, const struct {int _[a];} *b)
{
    for(size_t i=0; i < sizeof(b->_) / sizeof(b->_[0]); ++i)
        printf("%d ", b->_[i]);

     printf("%zu\n", sizeof(b->_));
}

void f(int a, struct {int _[a];} b)
{
    for(size_t i=0; i < sizeof(b._) / sizeof(b._[0]); ++i) //modify while
retaining the passed argument
        b._[i] *= 9;

    fp(a, &b); //prints 81 as many times as 'a'
}

main(int n, char **pp)
{
        scanf("%i", &n);

        struct {int _[n];} tmp;

        for(int i; i < n; ++i)
                tmp._[i] = 9;

        ((void (*)(int a, __typeof__(tmp) b))f)(n, tmp); //cast required as VM
types aren't equal in the case

        fp(n, &tmp); //should print 9 as many times as 'n'
}

Reply via email to