eric@CSE.OGI.EDU (Eric Hanchrow) (01/13/90)
gcc version 1.35. Here's the input file (call it `little.c'):
--------------------------------------------------------------------------------
/* This file demonstrates a puzzling error message from gcc 1.35. */
/* compile thusly
gcc -Wall -o little little.c
and you'll see an error message like this
little.c:20: warning: `Boy' defined but not used
*/
void
main(void)
{
static int Boy(char *);
Boy("Howdy!");
}
static int Boy(char *x)
{
return *x == 'H';
}
--------------------------------------------------------------------------------
tm.h: tm-sun386i.h
md.h: i386.md
Note: Since I had to save disk space, I zapped the source for gcc, so
I can't be positive that tm.h and md.h were linked to the above files;
however, I'm sure I used whichever were the most obvious for compiling
on a Sun386. The ``bug'' also occurs on a SparcStation, using gcc
built from the same source, with tm.h and md.h set to whatever must
have made sense for a Sparc machine at the time.
Machine: Sun 386i/150 and also Sun SparcStation 1
OS: SunOS 4.0.2 and also SunOS 4.0.3c
The ``incorrect behavior'' is the generation of an error message
saying the function is defined but not used. It sure looks to me like
I both defined it and used it!
I rather suspect that this isn't a bug at all, but some feature of the
`static' storage class that I don't understand. However, I couldn't
find anything in K & R (2nd ed.) that seemed pertinent, nor in the gcc
info manual. So...
Please let me know if you find anything interesting.
-------------------------------------------------------------------------
|Eric Hanchrow yamada-sun!eric@nosun.west.sun.com |
|Phase III Logic, Inc. ...!{tektronix, sun}!nosun!yamada-sun!eric |
|1600 N.W. 167th Place Beaverton, OR 97006 |
|Voice: (503)-645-0313 Fax: (503)-645-0207 as of 13-Dec-89 |
-------------------------------------------------------------------------