bcraig added a subscriber: bcraig. bcraig added a comment. > Even though they have artificial blocks in order to keep variables locally > scoped, this gives MSVC's /analyze a headache, because it views main() as > consuming an enormous amount of stack space (it doesn't reuse stack, at least > for analysis). Splitting main() up into numbered test functions is slightly > friendlier to humans and massively friendlier to /analyze.
The optimizer tends to not reuse the stack space either, at least for Clang 3.8, MSVC 2010 (I know, ancient history), and various older GCCs. I'm not sure if modern GCCs or MSVCs do a better job of shrinking stacks when this scoping pattern is used, or when lots of statement-lifetime temporaries are involved. Both patterns have caused me considerable grief on small stack systems. You may want to look at test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp and test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp. They involve giant functions with lots of scoping, and they have both caused me stack pain that I haven't specifically tried to solve yet. http://reviews.llvm.org/D21345 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits