Bug 181894 - Optimization level on g++ affects warnings for unused parameters
Optimization level on g++ affects warnings for unused parameters
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc (Show other bugs)
4.0
i586 Linux
medium Severity low
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks: RHEL3U8CanFix
  Show dependency treegraph
 
Reported: 2006-02-17 11:42 EST by Fritz Boehm
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2006-0454
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-20 10:32:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
simple C++ program that shows the gcc behavior (327 bytes, text/plain)
2006-02-17 11:42 EST, Fritz Boehm
no flags Details

  None (edit)
Description Fritz Boehm 2006-02-17 11:42:20 EST
Description of problem:
When -O2 is used to compile the file (below) no warnings are produced.  When -O0
is used, however, warnings are (correctly) given.


Version-Release number of selected component (if applicable):
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)


How reproducible:
Every time.


Steps to Reproduce:
1. compile attached program like this:
g++ -c test.cc -Wall -W -Werror -O2
2. compare that to compiling it like this:
g++ -c test.cc -Wall -W -Werror -O0

  
Actual results:

With -O2 I get no messages.  With -O0 I get this:
cc1plus: warnings being treated as errors
test.cc: In member function `virtual int master::foo(int, int)':
test.cc:3: warning: unused parameter `int var1'
test.cc:3: warning: unused parameter `int var2'



Expected results:
I would expect the warnings regardless of optimization level.

Additional info:
Comment 1 Fritz Boehm 2006-02-17 11:42:20 EST
Created attachment 124822 [details]
simple C++ program that shows the gcc behavior
Comment 4 Bob Johnson 2006-04-11 11:48:30 EDT
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 3.8 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 3.8 release.
Comment 9 Red Hat Bugzilla 2006-07-20 10:32:46 EDT
An advisory 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-2006-0454.html
Comment 10 Jan Iven 2006-08-03 03:41:25 EDT
It looks like this g++ version now complains about unused parameters in system
files:
/usr/include/c++/3.2.3/i386-redhat-linux/bits/codecvt_specializations.h:84:
warning: unused
   parameter `int __ibom'
/usr/include/c++/3.2.3/i386-redhat-linux/bits/codecvt_specializations.h:84:
warning: unused
   parameter `int __ebom'
/usr/include/c++/3.2.3/bits/locale_facets.h:1014: warning: unused parameter `
   size_t __refs'
...
(this is also reported as Issue#99250)

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