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