c++/10048: Compiler doesn't catch failure to return a value - causes crashing code

Christian Convey cjc@cs.brown.edu
Wed Mar 12 22:08:00 GMT 2003


My apologies for misunderstanding the language.

Thanks for your help.

- Christian

bangerth@dealii.org wrote:
> Synopsis: Compiler doesn't catch failure to return a value - causes crashing code
> 
> State-Changed-From-To: open->closed
> State-Changed-By: bangerth
> State-Changed-When: Wed Mar 12 21:28:41 2003
> State-Changed-Why:
>     So what is the question? You are falling off the edge of
>     this function without a proper return statement. The standard 
>     says to this (6.6.3.2):
>       Flowing  off  the  end  of  a
>       function  is  equivalent  to  a  return with no value; this results in
>       undefined behavior in a value-returning function
>     
>     Undefined behavior is what you get here (a crash). If
>     you want the compiler to catch this, turn on warnings
>     which traps here.
>     
>     I think there's not much more gcc can do for you here...
>     
>     W.
> 
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10048

-- 
Christian Convey
Sr. Software Engineer
Computer Science Dept.,
Brown University



More information about the Gcc-bugs mailing list