🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1550

GCC does not warn for a serious code problem

#1550
From: Peter Wemm
Date: Thu, 17 Dec 1992 01:10
28 lines
1302 bytes
This is not really a bug, but is a serious "missing feature".

Consider this [flawed] code:

char *some_func(int i)
{
	char buf[1000];		/* Non static declaration */

	/* body of code writes to buf[] */

	return buf;
}

gcc -Wall does not utter a peep!  (Granted, the programmer needs a kick
in the backside (blush), but it would be nice if gcc would warn if
returning pointers to local variables caused a warning to be emitted.)

This is on GCC 2.2.2 in C++ mode on a SVR4/386 machine.

Typical compiler arguments: gcc -Wall -s -O2 -I./ -Iinclude/ dir/file.C

Thanks,

Peter
-- 
Peter Wemm : peter@zeus.dialix.oz.au   If it's broke, fix it (The MS-DOS way)
Work phone: +61-9-479-1855    If it aint broke, don't touch it (The Unix way)
Fax: +61-9-479-1134   If we can't fix it, it ain't broke (Maintainer's Motto)
Technical Details
Message-ID: <199212160910.AA25359@zeus.dialix.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zeus.dialix.oz.AU!peter

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zeus.dialix.oz.AU!peter
From: peter@zeus.dialix.oz.AU (Peter Wemm)
Subject: GCC does not warn for a serious code problem
Message-ID: <199212160910.AA25359@zeus.dialix.oz.au>
Sender: gnulists@ai.mit.edu
Reply-To: peter@dialix.oz.au
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 17 Dec 1992 01:10:21 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 29