🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Peter Wemm Thu, 17 Dec 1992 01:10
GCC does not warn for a serious code problem
#1550
Author: 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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads