Skip to content

Instantly share code, notes, and snippets.

@stepancheg
Created August 25, 2012 18:59
Show Gist options
  • Save stepancheg/3469333 to your computer and use it in GitHub Desktop.
Save stepancheg/3469333 to your computer and use it in GitHub Desktop.
import printer.*;
import unix;
record LargeRecord (
a: Array[RawPointer, 1024],
);
foo() {
var a = LargeRecord();
// call any function that is guaranteed to be not inlined
unix.write(-1, RawPointer(@a), 1);
}
bar(n) {
if (n > 0) {
foo();
bar(n - 1);
}
}
// crashes when compiled with -O2
// works fine with -O0
main() {
..for (n in 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000) {
println(n);
bar(n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment