diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-05-02 16:06:33 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-05-02 16:06:33 (GMT) |
commit | 335ca9eb0d2337314cbbec5eb19f9aeea0eaaca7 (patch) | |
tree | 0a0e8d65ee114cb89f58c3159488dd5523123309 /openssl/bugs/dggccbug.c | |
parent | a90d8737b83a4a5bb2bf91a9bdf48a3dad4b51fa (diff) | |
download | blt-335ca9eb0d2337314cbbec5eb19f9aeea0eaaca7.zip blt-335ca9eb0d2337314cbbec5eb19f9aeea0eaaca7.tar.gz blt-335ca9eb0d2337314cbbec5eb19f9aeea0eaaca7.tar.bz2 |
initial commit
Diffstat (limited to 'openssl/bugs/dggccbug.c')
-rw-r--r-- | openssl/bugs/dggccbug.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/openssl/bugs/dggccbug.c b/openssl/bugs/dggccbug.c new file mode 100644 index 0000000..56f5222 --- /dev/null +++ b/openssl/bugs/dggccbug.c @@ -0,0 +1,45 @@ +/* NOCW */ +/* dggccbug.c */ +/* bug found by Eric Young (eay@cryptsoft.com) - May 1995 */ + +#include <stdio.h> + +/* + * There is a bug in gcc version 2.5.8 (88open OCS/BCS, DG-2.5.8.3, Oct 14 + * 1994) as shipped with DGUX 5.4R3.10 that can be bypassed by defining + * DG_GCC_BUG in my code. The bug manifests itself by the vaule of a pointer + * that is used only by reference, not having it's value change when it is + * used to check for exiting the loop. Probably caused by there being 2 + * copies of the valiable, one in a register and one being an address that is + * passed. + */ + +/*- + * compare the out put from + * gcc dggccbug.c; ./a.out + * and + * gcc -O dggccbug.c; ./a.out + * compile with -DFIXBUG to remove the bug when optimising. + */ + +void inc(a) +int *a; +{ + (*a)++; +} + +main() +{ + int p = 0; +#ifdef FIXBUG + int dummy; +#endif + + while (p < 3) { + fprintf(stderr, "%08X\n", p); + inc(&p); +#ifdef FIXBUG + dummy += p; +#endif + } +} |