This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3821: abort() not known to be noreturn in C++ only
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3821: abort() not known to be noreturn in C++ only
- From: bh at techhouse dot org
- Date: 25 Jul 2001 20:37:31 -0000
- Reply-To: bh at techhouse dot org
>Number: 3821
>Category: c++
>Synopsis: abort() not known to be noreturn in C++ only
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jul 25 13:46:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: bh@techhouse.org
>Release: 3.0
>Organization:
>Environment:
sparc-sun-solaris2.8
>Description:
I can compile the program in how-to-repeat either as C or
C++. It works in C, as expected; it fails in C++ with:
foo.cpp:10: warning: control reaches end of non-void function
Seems that the C++ parts don't realize that abort() is
a noreturn function.
>How-To-Repeat:
cat > foo.c << EOF
#include <stdlib.h>
int foo(int x) {
switch(x) {
case 1:
return 1;
default:
abort();
}
}
EOF
cp foo.c foo.cpp
gcc -c -O2 -Wall foo.c # works
gcc -c -O2 -Wall foo.cpp # fails
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: