4386991.c

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· C语言 代码 · 共 73 行

C
73
字号
/* APPLE LOCAL file 4386991 *//* { dg-do run } */#include <stdlib.h>#include <string.h>#include <stdio.h>/* "BarAnimationData" and these fieldnames are historical, from   HIToolbox where this originally broke.  */struct BarAnimationData{  int cid;  int window;  int startTime;  int totalTime;  float percentDone;  int *startBounds;  int *endBounds;  int *screenBounds;  int done;};void spook_optimizer (void *p) __attribute__ ((__noinline__));voidspook_optimizer (void *p){  printf ("", p);	/* Try to fool the optimizer escape analysis.  */}int GetCGSConnectionID(void) __attribute__ ((__noinline__));intGetCGSConnectionID(void){  return 42;}/* Test for complete initialization.  "AnimateBar" is historical;   it's from HIToolbox, where this originally broke.  */void AnimateBar (int) __attribute__ ((__noinline__));void AnimateBar (int window){  /* Initialize only the first two fields.  */  BarAnimationData data = { GetCGSConnectionID(), window };  /* Frighten the optimizer away.  */  spook_optimizer ((void *)&data);  if (data.startTime) abort ();  if (data.totalTime) abort ();  if (data.percentDone) abort ();  if (data.startBounds) abort ();  if (data.endBounds) abort ();  if (data.screenBounds) abort ();  if (data.done) abort ();}/* Clobber the local stack area with 0xffs.  */void smear_stack () __attribute__ ((__noinline__));voidsmear_stack (void){  char ary[400];  memset (&ary, 0xff, sizeof (ary));  spook_optimizer ((void *)&ary);}intmain (){  smear_stack ();  AnimateBar (42);  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?