[cfe-dev] clang and -Wframe-larger-than

David Blaikie dblaikie at gmail.com
Sat May 9 16:01:57 PDT 2015


On Fri, May 8, 2015 at 9:40 PM, Roman Bogorodskiy <bogorodskiy at gmail.com>
wrote:

> 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.


>
> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150509/cd5ea00b/attachment.html>


More information about the cfe-dev mailing list