Bug 105798 - warning in user code enables them in sys headers too
warning in user code enables them in sys headers too
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-27 13:32 EDT by David Nečas
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-16 12:25:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Nečas 2003-09-27 13:32:10 EDT
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 16:29:13 EDT
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 12:25:06 EST
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.