コード例 #1
0
ファイル: prog_stackgrowth.c プロジェクト: R7R8/simgrid
int main(int argc, char *argv[])
{
  int x;
  printf("%s", growsdown(&x) ? "down" : "up");

  return 0;
}
コード例 #2
0
static int growsdown(int *x)
{
  auto int y;
  y = (x > &y);
  if (--iterate > 0)
    y = growsdown(&y);
  if (y != (x > &y))
    exit(1);
  return y;
}
コード例 #3
0
int main(int argc, char *argv[])
{
  FILE *f;
  auto int x;
  if ((f = fopen("conftestval", "w")) == NULL)
    exit(1);
  fprintf(f, "%s\n", growsdown(&x) ? "down" : "up");;
  fclose(f);
  exit(0);
  return 1;
}
コード例 #4
0
ファイル: prog_stackgrowth.c プロジェクト: R7R8/simgrid
static int growsdown(int *x)
{
  int y = (x > &y);

  if (--iterate > 0)
    y = growsdown(&y);

  /* The stack sometimes changes at the 0th level. 
   * Original version did fail in this case, but I changed this around SimGrid 3.13 because of https://bugs.debian.org/814272
   * Every arch failed on that day :(
   */
  if (iterate != 0 && y != (x > &y)) {
    fprintf(stderr, "The stack changed its direction! (Iteration: %d. It was growing %s; &y=%p; &prevY=%p)\n",
	    (10-iterate), y?"down":"up", &y, x);
    exit(1);
  }
  return y;
}