Bug 78554

Summary: misleading warning of gcc 4.0
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Arvin Schnell <aschnell>
Component: DevelopmentAssignee: Michael Matz <matz>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: jengelh
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Arvin Schnell 2005-04-19 11:47:46 UTC
Compiling this little example gives confusing warnings:

int
test ()
{
    return;
    return 1;
}

return.c: In function ‘test’:
return.c:4: warning: ‘return’ with no value, in function returning non-void
return.c:6: warning: control reaches end of non-void function

The first warning is ok but the second is simply stupid and misleading.
Comment 1 Jan Engelhardt 2005-09-11 20:21:24 UTC
I think this is perfectly fine. Given that the optimizer will probably discard
and not analyze _any code anymore_ after the "return;", you're practically left
with what could be equal to:

int test() {
  return;
}

BTW, do you use -O, -O2 or any higher for your testcase?
Comment 2 Michael Matz 2005-09-12 06:14:02 UTC
That's why Arvin agrees that the first warning is okay.  And the second  
warning "control reaches end of non-void function" in a way just repeats 
the first one, and ergo is useless.  Anyway, this is nothing to fix locally 
in SuSE GCC, so it will come in with some later update to GCC 4.1. 
Comment 3 Stephan Kulow 2008-06-25 09:31:54 UTC
mass reopening all SuSE Linux bugs that are set to REMIND+LATER to change the resolution to WONTFIX (adapting to new policy)
Comment 4 Stephan Kulow 2008-06-25 09:33:21 UTC
mass reopening all SuSE Linux bugs that are set to REMIND+LATER to change the resolution to WONTFIX (adapting to new policy)
Comment 5 Stephan Kulow 2008-06-25 09:39:48 UTC
mass reopening all SuSE Linux bugs that are set to REMIND+LATER to change the resolution to WONTFIX (adapting to new policy)
Comment 6 Stephan Kulow 2008-06-25 09:49:28 UTC
Closing old LATER+REMIND bugs as WONTFIX - if you still plan to work on it, feel free to reopen and set to ASSIGNED.

In case the report saw repeated reopen comments, it's due to bugzilla timing out on the huge request ;(