This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/3821: abort() not known to be noreturn in C++ only



>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:
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]