]> git.ipfire.org Git - thirdparty/openssl.git/blame - bugs/dggccbug.c
Additional comment changes for reformat of 0.9.8
[thirdparty/openssl.git] / bugs / dggccbug.c
CommitLineData
d02b48c6
RE
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
3e8042c3
MC
17/*-
18 * compare the out put from
d02b48c6
RE
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
25void inc(a)
26int *a;
27 {
28 (*a)++;
29 }
30
31main()
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 }