This source file includes following definitions.
- halide_error
- main
#include <stdio.h>
#include "Halide.h"
using namespace Halide;
bool error_occurred = false;
void halide_error(void *user_context, const char *msg) {
printf("%s\n", msg);
error_occurred = true;
}
int main(int argc, char **argv) {
Var x;
Func f;
RDom r(0, 20);
f(x) = x;
f(r) = f(r-1) + f(r+1);
f.set_error_handler(&halide_error);
Buffer<int> result = f.realize(10);
if (!error_occurred) {
printf("There should have been an out-of-bounds error\n");
return 1;
}
printf("Success!\n");
return 0;
}