1 /* stack_overflow -- simple program generating a stack overflow */
3 /* Copyright (c) 2014-2018. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "simgrid/simix.h"
13 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "my log messages");
15 static unsigned collatz(unsigned c0, unsigned n)
21 x = collatz(c0, n - 1);
30 static int master(int argc, char* argv[])
32 XBT_INFO("Launching our nice bugged recursive function...");
34 while (i <= 0x80000000U) {
36 unsigned res = collatz(i, i);
37 XBT_VERB("collatz(%u, %u) returned %u", i, i, res);
42 int main(int argc, char* argv[])
44 SIMIX_global_init(&argc, argv);
46 xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
48 SIMIX_function_register("master", master);
49 SIMIX_create_environment(argv[1]);
50 simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);