MCPcopy Create free account
hub / github.com/csmith-project/csmith / need_nested_loop

Method need_nested_loop

src/Block.cpp:449–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449bool
450Block::need_nested_loop(const CGContext& cg_context)
451{
452 size_t i;
453 const Statement* s = get_last_stm();
454 if (looping && (s == NULL || !s->must_jump()) && cg_context.rw_directive) {
455 RWDirective* rwd = cg_context.rw_directive;
456 for (i=0; i<rwd->must_read_vars.size(); i++) {
457 size_t dimen = rwd->must_read_vars[i]->get_dimension();
458 if (dimen > cg_context.iv_bounds.size()) {
459 return true;
460 } else if (dimen == cg_context.iv_bounds.size() && rnd_flipcoin(10)) {
461 return true;
462 }
463 }
464 for (i=0; i<rwd->must_write_vars.size(); i++) {
465 size_t dimen = rwd->must_write_vars[i]->get_dimension();
466 if (dimen > cg_context.iv_bounds.size()) {
467 return true;
468 } else if (dimen == cg_context.iv_bounds.size() && rnd_flipcoin(10)) {
469 return true;
470 }
471 }
472 }
473 return false;
474}
475
476Statement*
477Block::append_nested_loop(CGContext& cg_context)

Callers 1

make_randomMethod · 0.80

Calls 4

rnd_flipcoinFunction · 0.85
sizeMethod · 0.80
must_jumpMethod · 0.45
get_dimensionMethod · 0.45

Tested by

no test coverage detected