Bug 781473 - gcc compiler show false warning on correct code
Summary: gcc compiler show false warning on correct code
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: 15
Hardware: i686
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-13 15:12 UTC by Segey A. Murylev
Modified: 2012-01-13 16:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-13 16:36:55 UTC
Type: Bug


Attachments (Terms of Use)
test source code (120 bytes, application/octet-stream)
2012-01-13 15:14 UTC, Segey A. Murylev
no flags Details

Description Segey A. Murylev 2012-01-13 15:12:55 UTC
Description of problem:
gcc compiler show false warning on correct code
actually this source compiled by g++ compiler from same toolchain with same command line keys don't display this warning.

Version-Release number of selected component (if applicable):
gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)

How reproducible:
Compile source, attached to this bug with '-Wall' key.

Steps to Reproduce:
1. Compile source attached to this bug as listed below:
  
Actual results:
$ c99 -Wall test.c 
test.c: In function ‘main’:
test.c:8:5: warning: passing argument 1 of ‘foo’ from incompatible pointer type [enabled by default]
test.c:3:6: note: expected ‘const char * const*’ but argument is of type ‘char **’
$

Expected results:
$ c99 -Wall test.c 
$

Additional info:
$ c++ -Wall test.c 
$

Comment 1 Segey A. Murylev 2012-01-13 15:14:35 UTC
Created attachment 555082 [details]
test source code

Comment 2 Jakub Jelinek 2012-01-13 16:36:55 UTC
The warning is correct.  C and C++ are different languages, so it is not surprising that sometimes you get a warning or error in one of them and not the other one.


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