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]
Other format: [Raw text]

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


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


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