The attached code says "int a = 100;", but it should normally be
initialized with an "undefined value", but in the case of gcc-10, it is
initialized with "0". Isn't this a bug in gcc-10?
#include <stdio.h>

int main(void)
{
    int n;

    for (n = 1;n <= 5;n++) {
        switch (n)
        {   int a = 100;
            static int b = 200;
            a = 111;
            b = 222;
        case 1:
            ++a; ++b;
            printf("case1: a = %d b = %d\n", a, b);
            break;
        case 3:
            ++a; ++b;
            printf("case3: a = %d b = %d\n", a, b);
        }
    }
    for (n = 1;n <= 3;n++) {
        int c = 300;
        static int d = 400;
        ++c; ++d;
        printf("for: c = %d d = %d\n", c, d);
    }
    return 0;
}

Reply via email to