1 [ N.B. This bug strikes on a Sun 3 running SunOS 4 with the cc -O4 option
2 as well as on the sparc. -Mike ]
4 Date: Fri, 24 Feb 89 15:36:40 -0600
5 To: mike@wheaties.ai.mit.edu
6 From: Dave Cohrs <dave@cs.wisc.edu>
7 Subject: bug + fix in gnu grep 1.2 (from prep.ai.mit.edu)
9 I tried installing the GNU grep 1.2 on a Sun4 running 4.0.1 and
10 "Spencer test #36" failed. After some experimenting, I found and
11 fixed the bug. Well, actually, the bug in the the C compiler, but
12 I managed a workaround.
16 The Sun4 4.0.1 C compiler with -O doesn't generate the correct for
17 statements of the form
22 To be exact, "y;" gets executed, while "x;" should. This causes the
23 #define FETCH() to fail for test #36.
27 In an #ifdef sparc in dfa.c, I made two versions of FETCH, FETCH0() and
28 the regular FETCH(). The former takes only one argument, the latter
29 expects its 2nd argument to contain a non-nil string. This removes
30 the need to test the constant strings, and the compiler bug isn't
31 exercised. I then changed the one instance of FETCH() with a nil
32 second argument to be FETCH0() instead.
36 ===================================================================
38 retrieving revision 1.1
40 *** /tmp/,RCSt1a05930 Fri Feb 24 15:32:33 1989
41 --- dfa.c Fri Feb 24 15:23:34 1989
47 /* Note that characters become unsigned here. */
50 + * Sun4 4.0.1 C compiler can't compare constant strings correctly.
51 + * e.g. if("test") { x; } else { y; }
52 + * the compiler will not generate code to execute { x; }, but
53 + * executes { y; } instead.
59 + (c) = (unsigned char) *lexptr++; \
62 #define FETCH(c, eoferr) \
66 + (c) = (unsigned char) *lexptr++; \
70 + #define FETCH(c, eoferr) \
79 (c) = (unsigned char) *lexptr++; \