Additional comment changes for reformat of 1.0.2
[openssl.git] / bugs / dggccbug.c
1 /* NOCW */
2 /* dggccbug.c */
3 /* bug found by Eric Young (eay@cryptsoft.com) - 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 /*-
18  * compare the out put from
19  * gcc dggccbug.c; ./a.out
20  * and
21  * gcc -O dggccbug.c; ./a.out
22  * compile with -DFIXBUG to remove the bug when optimising.
23  */
24
25 void inc(a)
26 int *a;
27         {
28         (*a)++;
29         }
30
31 main()
32         {
33         int p=0;
34 #ifdef FIXBUG
35         int dummy;
36 #endif
37
38         while (p<3)
39                 {
40                 fprintf(stderr,"%08X\n",p);
41                 inc(&p);
42 #ifdef FIXBUG
43                 dummy+=p;
44 #endif
45                 }
46         }