Bug 105798 - warning in user code enables them in sys headers too
Summary: warning in user code enables them in sys headers too
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-09-27 17:32 UTC by David Nečas
Modified: 2007-04-18 16:57 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-01-16 17:25:06 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2003:354 0 normal SHIPPED_LIVE Updated gcc packages fix multiple bugs 2003-11-17 05:00:00 UTC

Description David Nečas 2003-09-27 17:32:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.10 (X11; Linux i686; U;) Gecko/20030314

Description of problem:
Following C source compiles cleanly with gcc -c -W -Wno-system-headers -O

#include <math.h>
int main(int argc, char *argv[])
{
  if (!argc) return 1;
  else return 0;
}

If one however changes the `return 1' to just `return', and thus creating a
function that can return either with or without a value

#include <math.h>
int main(int argc, char *argv[])
{
  if (!argc) return;
  else return 0;
}

gcc notices it not only in this source, but in math.h too, giving a few dozens
of warnings starting with

/usr/include/bits/mathinline.h: In function `__sgn':
/usr/include/bits/mathinline.h:291: warning: this function may return with or
without a value
/usr/include/bits/mathinline.h: In function `__sgnf':
/usr/include/bits/mathinline.h:291: warning: this function may return with or
without a value
...


Version-Release number of selected component (if applicable):
gcc-3.2.2-5

How reproducible:
Always

Steps to Reproduce:
1. create file z.c, as described in the second example above
2. compile it gcc -c -W -Wno-system-headers -O z.c
3. for comparison, do the same with the first example above
    

Actual Results:  Described above.

Expected Results:  Only a single warning:

z.c: In function `main':
z.c:7: warning: this function may return with or without a value


Additional info:

Comment 1 Jakub Jelinek 2003-10-01 20:29:13 UTC
See http://gcc.gnu.org/PR9862
I'll commit backport of that path to gcc-3_2-rhl8-branch and it will show up
in the next gcc-3.2.3-rh rpms.

Comment 2 David Lawrence 2004-01-16 17:25:06 UTC
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2003-354.html



Note You need to log in before you can comment on or make changes to this bug.