aboutsummaryrefslogtreecommitdiff
path: root/tests/icon/regression/o3_repeated_replace.zc
blob: 5cad477443465fd66caf5debc5a9fbbe8e38b323 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
include rt;
include run;
include icon;
// repeated find_replace on an o3 callee must keep the o3 caller's published view
// current (prologue coverage / generation guard), not a stale compiled stub.
o3 int target() { return 7; }
o3 int caller() { int s = 0; for (int i = 0; i < 3; i++) s += target(); return s; }
fn main() {
	let seven = run.tokens("7"), eight = run.tokens("8"), nine = run.tokens("9");
	rt.put_n(caller()); rt.put_c(' ');
	rt.put_n(icon.find_replace(target, seven, eight)); rt.put_c(' ');
	rt.put_n(caller()); rt.put_c(' ');
	rt.put_n(icon.find_replace(target, eight, nine)); rt.put_c(' ');
	rt.put_n(caller()); rt.put_c(10);
	return 0;
}