clang and -Wframe-larger-than

Hi,

I have a question regarding -Wframe-larger-than in clang. I'm building a
project (libvirt git version) that uses this flag. The system I build on
is FreeBSD 11.0-CURRENT amd64.

Build fails with:

virshtest.c:253:1: error: stack frame size of 5512 bytes in function
'mymain' [-Werror,-Wframe-larger-than=]
mymain(void)

This happens with:

FreeBSD clang version 3.6.0 (tags/RELEASE_360/final 230434) 20150225

I have tried some other versions as well and figured out that this one
also triggers the same error:

clang version 3.5.2 (tags/RELEASE_352/final)

However, this one works fine:

clang version 3.4.2 (tags/RELEASE_34/dot2-final)

I've also tried gcc:

gcc version 5.1.0 (FreeBSD Ports Collection)

And it also works fine.

Is that an intentional behavior that the newer clang versions (>=3.5)
generate a code with a larget stack frame size?

PS I'm not posting a complete CFLAGS line used in the project as it's
quite huge. Specific value for -Wframe-larger-than used is 4096. Please
let me know if some other information is needed.

Thanks,

Roman Bogorodskiy

Hi,

I have a question regarding -Wframe-larger-than in clang. I'm building a
project (libvirt git version) that uses this flag. The system I build on
is FreeBSD 11.0-CURRENT amd64.

Build fails with:

virshtest.c:253:1: error: stack frame size of 5512 bytes in function
'mymain' [-Werror,-Wframe-larger-than=]
mymain(void)

This happens with:

FreeBSD clang version 3.6.0 (tags/RELEASE_360/final 230434) 20150225

I have tried some other versions as well and figured out that this one
also triggers the same error:

clang version 3.5.2 (tags/RELEASE_352/final)

However, this one works fine:

clang version 3.4.2 (tags/RELEASE_34/dot2-final)

I think we implemented -Wframe-larger-than in clang relatievly recently, so
I wouldn't be too surprised if it didn't fire in older releases of Clang

I've also tried gcc:

gcc version 5.1.0 (FreeBSD Ports Collection)

Clang and GCC produce different frame layouts, especially at -O0 Clang
doesn't do much in the way of stack reuse, so it wouldn't surprise me if
the warning fires on Clang -O0 but not GCC.