1

compiler: https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/arm-eabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-eabi.tar.xz

test.c:

struct Foo{
    char a[32]; // 32 and above will produce warning, but 31 and below will not
    char d[9]; // 9 and above will produce warning, but 8 and below will not
};

int main()
{
    struct Foo foo = {0};
    (void)(foo);
    return 0;
}

compile command and warning:

$ arm-eabi-gcc -Wstack-protector -fstack-protector-all -fstack-check -o test test.c
test.c: In function ‘main’:
test.c:6:5: warning: stack protector not protecting local variables: variable length buffer [-Wstack-protector]
 int main()
     ^~~~

The struct in my source is something like Foo in the source shown above, it can not be changed, therefore what can i do with the main function to solve the warning?

Any help would be much appreciated!

tteng little
  • 161
  • 1
  • 1
  • 6

0 Answers0