This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug egcs 1.1.1
- To: nradisch at panix dot com
- Subject: Re: bug egcs 1.1.1
- From: "Matthias Urlichs" <smurf at noris dot de>
- Date: Sun, 20 Jun 1999 22:11:14 +0200
- Cc: egcs-bugs at egcs dot cygnus dot com
- References: <376D3F09.AD0D7428@panix.com>
Hi,
nradisch@panix.com:
> If a function that should return a value does not, no error or warning
> is given. This frequently results in hard to find program crashes.
>
It's not the problem of GCC if you don't turn on any warnings.
... was my first impression. Unfortunately, your code sometimes really
_does_ not cause any warning to be emitted even under -W.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
int foo(void)
{
extern int bar(void);
int something = bar();
if (something == 5) return 12;
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
With 2.95-current:
$ gcc -c -Wall /tmp/foo.c -o /tmp/foo.o
/tmp/foo.c: In function `foo':
/tmp/foo.c:6: warning: control reaches end of non-void function
$ gcc -c -W /tmp/foo.c -o /tmp/foo.o
/tmp/foo.c: In function `foo':
/tmp/foo.c:6: warning: this function may return with or without a value
$ gcc -O1 -c -W /tmp/foo.c -o /tmp/foo.o
/tmp/foo.c: In function `foo':
/tmp/foo.c:6: warning: this function may return with or without a value
$ gcc -O2 -c -W /tmp/foo.c -o /tmp/foo.o
/tmp/foo.c: In function `foo':
/tmp/foo.c:6: warning: this function may return with or without a value
$ gcc -O3 -c -Wall /tmp/foo.c -o /tmp/foo.o
/tmp/foo.c: In function `foo':
/tmp/foo.c:6: warning: control reaches end of non-void function
$ gcc -O3 -c -W /tmp/foo.c -o /tmp/foo.o
$ ## note: NO output here
The "-O3 -W" case doesn't look right...
--
Matthias Urlichs | noris network GmbH | smurf@noris.de | ICQ: 20193661
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
Happy hacking.