kevin@kosman.nrc.com (Kevin O`Gorman) (01/11/90)
Here is the example. The problem is in the preprocessor. This thing
compiles just fine with *my* traditional compiler, or with normal gcc.
It fails with gcc -traditional.
It has been observed in gcc 1.35 and 1.36.
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: bug.c
# Wrapped by kevin@kosman on Wed Jan 10 16:55:15 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'bug.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bug.c'\"
else
echo shar: Extracting \"'bug.c'\" \(631 characters\)
sed "s/^X//" >'bug.c' <<'END_OF_FILE'
X/* This program gives trouble if it is compiled with -traditional, as in
X gcc -E -traditional bug.c
X even though it will compile just fine on my 3b1 with the stock compiler
X (which I think is PCC, but is anyway a traditional AT&T C compiler)
X
X This is a much edited version of MUSH 7.0.3 routine glob.c
X */
X
X
X#undef TEST
X#undef TEST2
X
X#ifdef TEST
X
X/* This shows how the T thing might be used. The problem is partly that
X TEST is undefined, and T does not get defined */
X#define T(a) printf("%s",a);
X
Xmain()
X{
X
X#ifdef TEST2
X /* the following line causes the problem by starting a comment */
X T("/*");
X#endif
X}
X
X#endif
END_OF_FILE
if test 631 -ne `wc -c <'bug.c'`; then
echo shar: \"'bug.c'\" unpacked with wrong size!
fi
chmod +x 'bug.c'
# end of 'bug.c'
fi
echo shar: End of shell archive.
exit 0
--
Kevin O'Gorman ( kevin@kosman.UUCP, kevin%kosman.uucp@nrc.com )
voice: 805-984-8042 Vital Computer Systems, 5115 Beachcomber, Oxnard, CA 93035
Non-Disclaimer: my boss is me, and he stands behind everything I say.