This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning
- From: am-99173 at konami dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 3 Jul 2002 03:58:34 -0000
- Subject: optimization/7189: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning
- Reply-to: am-99173 at konami dot com
>Number: 7189
>Category: optimization
>Synopsis: gcc -O2 -Wall does not print ``control reaches end of non-void function'' warning
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Tue Jul 02 21:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Honda Hiroki
>Release: gcc version 3.1
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
[gcc -O -Wall] reasonably prints a warning message complaining ``control reaches end of non-void function''. [gcc -O2 -Wall] should also print the same warning message. However, [gcc -O2 -Wall] silently succeeds.
cd /tmp
tar xfz gcc-3.1.tar.gz
mkdir /tmp/build
mkdir /tmp/experiment
cd /tmp/build
../gcc-3.1/configure \
--prefix=/tmp/experiment \
--enable-languages=c
make bootstrap
make install
cd /tmp
echo "extern void foo(void);" > chk.c
echo "int bar(void) { foo(); }" >> chk.c
/tmp/experiment/bin/gcc -S -O -Wall chk.c
--> "warning: control reaches end of ..."
(correct behavior)
/tmp/experiment/bin/gcc -S -O2 -Wall chk.c
--> compilation silently succeeds
(wrong behavior)
>How-To-Repeat:
extern void foo(void);
int bar(void) { foo(); }
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: