From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25067 invoked by alias); 12 Mar 2003 21:28:41 -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 25048 invoked by uid 48); 12 Mar 2003 21:28:41 -0000 Date: Wed, 12 Mar 2003 21:28:00 -0000 Message-ID: <20030312212841.25047.qmail@sources.redhat.com> To: cjc@cs.brown.edu, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org From: bangerth@dealii.org Reply-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 Subject: Re: c++/10048: Compiler doesn't catch failure to return a value - causes crashing code X-SW-Source: 2003-03/txt/msg00737.txt.bz2 List-Id: 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