OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
dggccbug.c
Go to the documentation of this file.
1 /* NOCW */
2 /* dggccbug.c */
3 /* bug found by Eric Young ([email protected]) - May 1995 */
4 
5 #include <stdio.h>
6 
7 /* There is a bug in
8  * gcc version 2.5.8 (88open OCS/BCS, DG-2.5.8.3, Oct 14 1994)
9  * as shipped with DGUX 5.4R3.10 that can be bypassed by defining
10  * DG_GCC_BUG in my code.
11  * The bug manifests itself by the vaule of a pointer that is
12  * used only by reference, not having it's value change when it is used
13  * to check for exiting the loop. Probably caused by there being 2
14  * copies of the valiable, one in a register and one being an address
15  * that is passed. */
16 
17 /* compare the out put from
18  * gcc dggccbug.c; ./a.out
19  * and
20  * gcc -O dggccbug.c; ./a.out
21  * compile with -DFIXBUG to remove the bug when optimising.
22  */
23 
24 void inc(a)
25 int *a;
26  {
27  (*a)++;
28  }
29 
31  {
32  int p=0;
33 #ifdef FIXBUG
34  int dummy;
35 #endif
36 
37  while (p<3)
38  {
39  fprintf(stderr,"%08X\n",p);
40  inc(&p);
41 #ifdef FIXBUG
42  dummy+=p;
43 #endif
44  }
45  }