From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30500 invoked by alias); 12 Mar 2003 21:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 30464 invoked by uid 71); 12 Mar 2003 21:36:00 -0000 Date: Wed, 12 Mar 2003 21:36:00 -0000 Message-ID: <20030312213600.30463.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Christian Convey Subject: Re: c++/10048: Compiler doesn't catch failure to return a value - causes crashing code Reply-To: Christian Convey X-SW-Source: 2003-03/txt/msg00739.txt.bz2 List-Id: The following reply was made to PR c++/10048; it has been noted by GNATS. From: Christian Convey To: bangerth@dealii.org, cjc@cs.brown.edu, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/10048: Compiler doesn't catch failure to return a value - causes crashing code Date: Wed, 12 Mar 2003 16:30:28 -0500 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