This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
optimization/5377: Warning not given when optimizing
- From: booh at altern dot org
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Jan 2002 16:18:53 -0000
- Subject: optimization/5377: Warning not given when optimizing
- Reply-to: booh at altern dot org
>Number: 5377
>Category: optimization
>Synopsis: Warning not given when optimizing
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Mon Jan 14 08:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: booh@altern.org
>Release: gcc-3.0.3
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
Here are the results with some versions, note that
only the latest shows the problem.
gcc-2.95.3 -Wreturn-type -O2 -finline-functions :
In function `function':
warning: control reaches end of non-void function
gcc-3.0.3 -Wreturn-type -O2 :
In function `function':
warning: control reaches end of non-void function
/* ./a.out returns 123. */
gcc-3.0.3 -Wreturn-type -O2 -finline-functions
/* No warning. */
So the problem is that in the last compilation
the warning is not given and the function()
returns nothing.
>How-To-Repeat:
static int global_variable;
static int
function (void)
{
/* Just for function() to do something. */
global_variable = 123;
}
int
main (void)
{
return function ();
}
>Fix:
Maybe check_function_return_warnings() should be called before considering making the function inline.
>Release-Note:
>Audit-Trail:
>Unformatted: