[PATCH] D21345: [libcxx] [test] Avoid huge main() functions and huge arrays.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 14:11:49 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Avoid huge main() functions and huge arrays.

Fixes MSVC warning C6262 "Function uses '62000' bytes of stack:  exceeds /analyze:stacksize '16384'.  Consider moving some data to heap."

Several random distribution tests featured huge main() functions. 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.

Additionally, is_swappable_include_order.pass.cpp had a busted comment, and a 42 * 50 multidim array of doubles (actually two of them). That's a lot of stack space: 42 * 50 * 8 * 2 = 33600. As the actual size isn't important, I've reduced this to 17 by 29, which fits comfortably within /analyze's default stack (7888 bytes is less than 16K).

http://reviews.llvm.org/D21345

Files:
  test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
  test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21345.60745.patch
Type: text/x-patch
Size: 187568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160614/1c585e4a/attachment-0001.bin>


More information about the cfe-commits mailing list