Article View: gnu.gcc.bug
Article #2834Is it me, or is this warning message a bug?
From: Eric Hanchrow
Date: Fri, 12 Jan 1990 22:02
Date: Fri, 12 Jan 1990 22:02
54 lines
2470 bytes
2470 bytes
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 |
-------------------------------------------------------------------------
Technical Details
Message-ID:
<9001122202.AA18050@yamada-sun.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!CSE.OGI.EDU!nosun!yamada-sun!ericShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!CSE.OGI.EDU!nosun!yamada-sun!eric From: nosun!yamada-sun!eric@CSE.OGI.EDU (Eric Hanchrow) Newsgroups: gnu.gcc.bug Subject: Is it me, or is this warning message a bug? Message-ID: <9001122202.AA18050@yamada-sun.UUCP> Date: 12 Jan 90 22:02:19 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 54